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

Side by Side Diff: xfa/fwl/basewidget/fwl_editimp.cpp

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 5 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/basewidget/fwl_editimp.h ('k') | xfa/fwl/basewidget/fwl_formproxyimp.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/basewidget/fwl_editimp.h" 7 #include "xfa/fwl/basewidget/fwl_editimp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return static_cast<CFWL_EditImp*>(GetImpl()) 196 return static_cast<CFWL_EditImp*>(GetImpl())
197 ->ReplaceSpellCheckWord(pointf, bsReplace); 197 ->ReplaceSpellCheckWord(pointf, bsReplace);
198 } 198 }
199 199
200 CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties, 200 CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties,
201 IFWL_Widget* pOuter) 201 IFWL_Widget* pOuter)
202 : CFWL_WidgetImp(properties, pOuter), 202 : CFWL_WidgetImp(properties, pOuter),
203 m_fVAlignOffset(0.0f), 203 m_fVAlignOffset(0.0f),
204 m_fScrollOffsetX(0.0f), 204 m_fScrollOffsetX(0.0f),
205 m_fScrollOffsetY(0.0f), 205 m_fScrollOffsetY(0.0f),
206 m_pEdtEngine(NULL), 206 m_pEdtEngine(nullptr),
207 m_bLButtonDown(FALSE), 207 m_bLButtonDown(FALSE),
208 m_nSelStart(0), 208 m_nSelStart(0),
209 m_nLimit(-1), 209 m_nLimit(-1),
210 m_fSpaceAbove(0), 210 m_fSpaceAbove(0),
211 m_fSpaceBelow(0), 211 m_fSpaceBelow(0),
212 m_fFontSize(0), 212 m_fFontSize(0),
213 m_bSetRange(FALSE), 213 m_bSetRange(FALSE),
214 m_iMin(-1), 214 m_iMin(-1),
215 m_iMax(0xFFFFFFF), 215 m_iMax(0xFFFFFFF),
216 m_backColor(0), 216 m_backColor(0),
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 CFX_RectF rtClip = m_rtEngine; 482 CFX_RectF rtClip = m_rtEngine;
483 CFX_Matrix mt; 483 CFX_Matrix mt;
484 mt.Set(1, 0, 0, 1, fOffSetX, fOffSetY); 484 mt.Set(1, 0, 0, 1, fOffSetX, fOffSetY);
485 if (pMatrix) { 485 if (pMatrix) {
486 pMatrix->TransformRect(rtClip); 486 pMatrix->TransformRect(rtClip);
487 mt.Concat(*pMatrix); 487 mt.Concat(*pMatrix);
488 } 488 }
489 pGraphics->SetClipRect(rtClip); 489 pGraphics->SetClipRect(rtClip);
490 pGraphics->SetStrokeColor(&crLine); 490 pGraphics->SetStrokeColor(&crLine);
491 pGraphics->SetLineWidth(0); 491 pGraphics->SetLineWidth(0);
492 pGraphics->StrokePath(&pathSpell, NULL); 492 pGraphics->StrokePath(&pathSpell, nullptr);
493 } 493 }
494 pGraphics->RestoreGraphState(); 494 pGraphics->RestoreGraphState();
495 } 495 }
496 FWL_Error CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, 496 FWL_Error CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics,
497 const CFX_Matrix* pMatrix) { 497 const CFX_Matrix* pMatrix) {
498 if (!pGraphics) 498 if (!pGraphics)
499 return FWL_Error::Indefinite; 499 return FWL_Error::Indefinite;
500 if (!m_pProperties->m_pThemeProvider) 500 if (!m_pProperties->m_pThemeProvider)
501 return FWL_Error::Indefinite; 501 return FWL_Error::Indefinite;
502 if (m_rtClient.IsEmpty()) { 502 if (m_rtClient.IsEmpty()) {
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 ShowCaret(bShow, &rtCaret); 1357 ShowCaret(bShow, &rtCaret);
1358 } 1358 }
1359 IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() { 1359 IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() {
1360 FX_BOOL bShowHorz = 1360 FX_BOOL bShowHorz =
1361 m_pHorzScrollBar && 1361 m_pHorzScrollBar &&
1362 ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0); 1362 ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0);
1363 FX_BOOL bShowVert = 1363 FX_BOOL bShowVert =
1364 m_pVertScrollBar && 1364 m_pVertScrollBar &&
1365 ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0); 1365 ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0);
1366 if (!bShowHorz && !bShowVert) { 1366 if (!bShowHorz && !bShowVert) {
1367 return NULL; 1367 return nullptr;
1368 } 1368 }
1369 IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0); 1369 IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
1370 if (!pPage) 1370 if (!pPage)
1371 return NULL; 1371 return nullptr;
1372 const CFX_RectF& rtFDE = pPage->GetContentsBox(); 1372 const CFX_RectF& rtFDE = pPage->GetContentsBox();
1373 IFWL_ScrollBar* pRepaint = NULL; 1373 IFWL_ScrollBar* pRepaint = nullptr;
1374 if (bShowHorz) { 1374 if (bShowHorz) {
1375 CFX_RectF rtScroll; 1375 CFX_RectF rtScroll;
1376 m_pHorzScrollBar->GetWidgetRect(rtScroll); 1376 m_pHorzScrollBar->GetWidgetRect(rtScroll);
1377 if (rtScroll.width < rtFDE.width) { 1377 if (rtScroll.width < rtFDE.width) {
1378 m_pHorzScrollBar->LockUpdate(); 1378 m_pHorzScrollBar->LockUpdate();
1379 FX_FLOAT fRange = rtFDE.width - rtScroll.width; 1379 FX_FLOAT fRange = rtFDE.width - rtScroll.width;
1380 m_pHorzScrollBar->SetRange(0.0f, fRange); 1380 m_pHorzScrollBar->SetRange(0.0f, fRange);
1381 FX_FLOAT fPos = m_fScrollOffsetX; 1381 FX_FLOAT fPos = m_fScrollOffsetX;
1382 if (fPos < 0.0f) { 1382 if (fPos < 0.0f) {
1383 fPos = 0.0f; 1383 fPos = 0.0f;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 m_pHorzScrollBar->Update(); 1544 m_pHorzScrollBar->Update();
1545 } else if (m_pHorzScrollBar) { 1545 } else if (m_pHorzScrollBar) {
1546 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, TRUE); 1546 m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, TRUE);
1547 } 1547 }
1548 } 1548 }
1549 void CFWL_EditImp::LayoutScrollBar() { 1549 void CFWL_EditImp::LayoutScrollBar() {
1550 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) == 1550 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) ==
1551 0) { 1551 0) {
1552 return; 1552 return;
1553 } 1553 }
1554 FX_FLOAT* pfWidth = NULL; 1554 FX_FLOAT* pfWidth = nullptr;
1555 FX_BOOL bShowVertScrollbar = IsShowScrollBar(TRUE); 1555 FX_BOOL bShowVertScrollbar = IsShowScrollBar(TRUE);
1556 FX_BOOL bShowHorzScrollbar = IsShowScrollBar(FALSE); 1556 FX_BOOL bShowHorzScrollbar = IsShowScrollBar(FALSE);
1557 if (bShowVertScrollbar) { 1557 if (bShowVertScrollbar) {
1558 if (!m_pVertScrollBar) { 1558 if (!m_pVertScrollBar) {
1559 pfWidth = static_cast<FX_FLOAT*>( 1559 pfWidth = static_cast<FX_FLOAT*>(
1560 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 1560 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
1561 FX_FLOAT fWidth = pfWidth ? *pfWidth : 0; 1561 FX_FLOAT fWidth = pfWidth ? *pfWidth : 0;
1562 InitScrollBar(); 1562 InitScrollBar();
1563 CFX_RectF rtVertScr; 1563 CFX_RectF rtVertScr;
1564 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { 1564 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 } 2186 }
2187 CFX_RectF rect; 2187 CFX_RectF rect;
2188 m_pOwner->GetWidgetRect(rect); 2188 m_pOwner->GetWidgetRect(rect);
2189 CFX_RectF rtInvalidate; 2189 CFX_RectF rtInvalidate;
2190 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); 2190 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
2191 m_pOwner->Repaint(&rtInvalidate); 2191 m_pOwner->Repaint(&rtInvalidate);
2192 } 2192 }
2193 return TRUE; 2193 return TRUE;
2194 } 2194 }
2195 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} 2195 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {}
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_editimp.h ('k') | xfa/fwl/basewidget/fwl_formproxyimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698