Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: xfa/fwl/core/fwl_formimp.cpp

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/fwl_formimp.h ('k') | xfa/fwl/core/fwl_noteimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/core/fwl_formimp.h" 7 #include "xfa/fwl/core/fwl_formimp.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 m_pNoteLoop = new CFWL_NoteLoop(this); 386 m_pNoteLoop = new CFWL_NoteLoop(this);
387 pDriver->PushNoteLoop(m_pNoteLoop); 387 pDriver->PushNoteLoop(m_pNoteLoop);
388 m_bDoModalFlag = TRUE; 388 m_bDoModalFlag = TRUE;
389 SetStates(FWL_WGTSTATE_Invisible, FALSE); 389 SetStates(FWL_WGTSTATE_Invisible, FALSE);
390 pDriver->Run(); 390 pDriver->Run();
391 #if (_FX_OS_ == _FX_MACOSX_) 391 #if (_FX_OS_ == _FX_MACOSX_)
392 #else 392 #else
393 pDriver->PopNoteLoop(); 393 pDriver->PopNoteLoop();
394 #endif 394 #endif
395 delete m_pNoteLoop; 395 delete m_pNoteLoop;
396 m_pNoteLoop = NULL; 396 m_pNoteLoop = nullptr;
397 return NULL; 397 return nullptr;
398 } 398 }
399 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { 399 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) {
400 return DoModal(); 400 return DoModal();
401 } 401 }
402 FWL_Error CFWL_FormImp::EndDoModal() { 402 FWL_Error CFWL_FormImp::EndDoModal() {
403 if (!m_pNoteLoop) 403 if (!m_pNoteLoop)
404 return FWL_Error::Indefinite; 404 return FWL_Error::Indefinite;
405 m_bDoModalFlag = FALSE; 405 m_bDoModalFlag = FALSE;
406 #if (_FX_OS_ == _FX_MACOSX_) 406 #if (_FX_OS_ == _FX_MACOSX_)
407 m_pNoteLoop->EndModalLoop(); 407 m_pNoteLoop->EndModalLoop();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 488 }
489 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { 489 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) {
490 return m_pMaxBox; 490 return m_pMaxBox;
491 } 491 }
492 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { 492 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) {
493 return m_pMinBox; 493 return m_pMinBox;
494 } 494 }
495 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) { 495 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) {
496 return m_pCaptionBox; 496 return m_pCaptionBox;
497 } 497 }
498 return NULL; 498 return nullptr;
499 } 499 }
500 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { 500 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) {
501 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) { 501 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) {
502 return m_pCloseBox; 502 return m_pCloseBox;
503 } 503 }
504 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) { 504 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) {
505 return m_pMaxBox; 505 return m_pMaxBox;
506 } 506 }
507 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) { 507 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) {
508 return m_pMinBox; 508 return m_pMinBox;
509 } 509 }
510 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) { 510 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) {
511 return m_pCaptionBox; 511 return m_pCaptionBox;
512 } 512 }
513 return NULL; 513 return nullptr;
514 } 514 }
515 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) { 515 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) {
516 if (nIndex < 0) 516 if (nIndex < 0)
517 return nullptr; 517 return nullptr;
518 518
519 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; 519 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn;
520 if (m_pMinBox) 520 if (m_pMinBox)
521 arrBtn.Add(m_pMinBox); 521 arrBtn.Add(m_pMinBox);
522 522
523 if (m_pMaxBox) 523 if (m_pMaxBox)
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 790 }
791 void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft, 791 void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft,
792 FX_FLOAT& fWidth, 792 FX_FLOAT& fWidth,
793 FX_FLOAT fCurX, 793 FX_FLOAT fCurX,
794 FX_FLOAT fSpace, 794 FX_FLOAT fSpace,
795 FX_FLOAT fLimitMin, 795 FX_FLOAT fLimitMin,
796 FX_FLOAT fLimitMax, 796 FX_FLOAT fLimitMax,
797 FX_BOOL bLeft) { 797 FX_BOOL bLeft) {
798 FX_FLOAT fx = fCurX; 798 FX_FLOAT fx = fCurX;
799 FX_FLOAT fy = 0; 799 FX_FLOAT fy = 0;
800 TransformTo(NULL, fx, fy); 800 TransformTo(nullptr, fx, fy);
801 FX_FLOAT fTemp = 801 FX_FLOAT fTemp =
802 bLeft ? (fWidth - fx + fLeft + fSpace) : (fx - fLeft + fSpace); 802 bLeft ? (fWidth - fx + fLeft + fSpace) : (fx - fLeft + fSpace);
803 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { 803 if (fTemp >= fLimitMin && fTemp <= fLimitMax) {
804 fWidth = fTemp; 804 fWidth = fTemp;
805 fLeft += bLeft ? (fx - fLeft - fSpace) : 0; 805 fLeft += bLeft ? (fx - fLeft - fSpace) : 0;
806 } else { 806 } else {
807 if (fTemp < fLimitMin && fWidth > fLimitMin) { 807 if (fTemp < fLimitMin && fWidth > fLimitMin) {
808 fLeft += bLeft ? (fWidth - fLimitMin) : 0; 808 fLeft += bLeft ? (fWidth - fLimitMin) : 0;
809 fWidth = fLimitMin; 809 fWidth = fLimitMin;
810 } else if (fTemp > fLimitMax && fWidth < fLimitMax) { 810 } else if (fTemp > fLimitMax && fWidth < fLimitMax) {
811 fLeft -= bLeft ? (fLimitMax - fWidth) : 0; 811 fLeft -= bLeft ? (fLimitMax - fWidth) : 0;
812 fWidth = fLimitMax; 812 fWidth = fLimitMax;
813 } 813 }
814 } 814 }
815 } 815 }
816 void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop, 816 void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop,
817 FX_FLOAT& fHeight, 817 FX_FLOAT& fHeight,
818 FX_FLOAT fCurY, 818 FX_FLOAT fCurY,
819 FX_FLOAT fSpace, 819 FX_FLOAT fSpace,
820 FX_FLOAT fLimitMin, 820 FX_FLOAT fLimitMin,
821 FX_FLOAT fLimitMax, 821 FX_FLOAT fLimitMax,
822 FX_BOOL bTop) { 822 FX_BOOL bTop) {
823 FX_FLOAT fx = 0; 823 FX_FLOAT fx = 0;
824 FX_FLOAT fy = fCurY; 824 FX_FLOAT fy = fCurY;
825 TransformTo(NULL, fx, fy); 825 TransformTo(nullptr, fx, fy);
826 FX_FLOAT fTemp = bTop ? (fHeight - fy + fTop + fSpace) : (fy - fTop + fSpace); 826 FX_FLOAT fTemp = bTop ? (fHeight - fy + fTop + fSpace) : (fy - fTop + fSpace);
827 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { 827 if (fTemp >= fLimitMin && fTemp <= fLimitMax) {
828 fHeight = fTemp; 828 fHeight = fTemp;
829 fTop += bTop ? (fy - fTop - fSpace) : 0; 829 fTop += bTop ? (fy - fTop - fSpace) : 0;
830 } else { 830 } else {
831 if (fTemp < fLimitMin && fHeight > fLimitMin) { 831 if (fTemp < fLimitMin && fHeight > fLimitMin) {
832 fTop += bTop ? (fHeight - fLimitMin) : 0; 832 fTop += bTop ? (fHeight - fLimitMin) : 0;
833 fHeight = fLimitMin; 833 fHeight = fLimitMin;
834 } else if (fTemp > fLimitMax && fHeight < fLimitMax) { 834 } else if (fTemp > fLimitMax && fHeight < fLimitMax) {
835 fTop -= bTop ? (fLimitMax - fHeight) : 0; 835 fTop -= bTop ? (fLimitMax - fHeight) : 0;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } 1121 }
1122 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { 1122 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) {
1123 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; 1123 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx;
1124 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; 1124 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy;
1125 } 1125 }
1126 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { 1126 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) {
1127 CFWL_EvtClose eClose; 1127 CFWL_EvtClose eClose;
1128 eClose.m_pSrcTarget = m_pOwner->m_pInterface; 1128 eClose.m_pSrcTarget = m_pOwner->m_pInterface;
1129 m_pOwner->DispatchEvent(&eClose); 1129 m_pOwner->DispatchEvent(&eClose);
1130 } 1130 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_formimp.h ('k') | xfa/fwl/core/fwl_noteimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698