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

Side by Side Diff: xfa/fxfa/app/xfa_fwltheme.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/fxfa/app/xfa_fontmgr.cpp ('k') | xfa/fxfa/app/xfa_textlayout.h » ('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/fxfa/app/xfa_fwltheme.h" 7 #include "xfa/fxfa/app/xfa_fwltheme.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fgas/crt/fgas_codepage.h" 10 #include "xfa/fgas/crt/fgas_codepage.h"
(...skipping 27 matching lines...) Expand all
38 while (pOuter && pOuter->GetOuter()) 38 while (pOuter && pOuter->GetOuter())
39 pOuter = pOuter->GetOuter(); 39 pOuter = pOuter->GetOuter();
40 40
41 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()) 41 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem())
42 : nullptr; 42 : nullptr;
43 } 43 }
44 44
45 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) { 45 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) {
46 m_dwCapacity = 0; 46 m_dwCapacity = 0;
47 m_fCapacity = 0; 47 m_fCapacity = 0;
48 m_pCalendarFont = NULL; 48 m_pCalendarFont = nullptr;
49 m_Rect.Set(0, 0, 0, 0); 49 m_Rect.Set(0, 0, 0, 0);
50 m_pCheckBoxTP = new CXFA_FWLCheckBoxTP; 50 m_pCheckBoxTP = new CXFA_FWLCheckBoxTP;
51 m_pListBoxTP = new CFWL_ListBoxTP; 51 m_pListBoxTP = new CFWL_ListBoxTP;
52 m_pPictureBoxTP = new CFWL_PictureBoxTP; 52 m_pPictureBoxTP = new CFWL_PictureBoxTP;
53 m_pSrollBarTP = new CFWL_ScrollBarTP; 53 m_pSrollBarTP = new CFWL_ScrollBarTP;
54 m_pEditTP = new CXFA_FWLEditTP; 54 m_pEditTP = new CXFA_FWLEditTP;
55 m_pComboBoxTP = new CFWL_ComboBoxTP; 55 m_pComboBoxTP = new CFWL_ComboBoxTP;
56 m_pMonthCalendarTP = new CFWL_MonthCalendarTP; 56 m_pMonthCalendarTP = new CFWL_MonthCalendarTP;
57 m_pDateTimePickerTP = new CFWL_DateTimePickerTP; 57 m_pDateTimePickerTP = new CFWL_DateTimePickerTP;
58 m_pPushButtonTP = new CFWL_PushButtonTP; 58 m_pPushButtonTP = new CFWL_PushButtonTP;
(...skipping 18 matching lines...) Expand all
77 FWL_Error CXFA_FWLTheme::Initialize() { 77 FWL_Error CXFA_FWLTheme::Initialize() {
78 m_pTextOut.reset(new CFDE_TextOut); 78 m_pTextOut.reset(new CFDE_TextOut);
79 for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); 79 for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts);
80 ++i) { 80 ++i) {
81 m_pCalendarFont = IFGAS_Font::LoadFont(g_FWLTheme_CalFonts[i], 0, 0, 81 m_pCalendarFont = IFGAS_Font::LoadFont(g_FWLTheme_CalFonts[i], 0, 0,
82 m_pApp->GetFDEFontMgr()); 82 m_pApp->GetFDEFontMgr());
83 } 83 }
84 if (!m_pCalendarFont) { 84 if (!m_pCalendarFont) {
85 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 85 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
86 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage( 86 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage(
87 FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); 87 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr);
88 #else 88 #else
89 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( 89 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage(
90 FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); 90 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr);
91 #endif 91 #endif
92 } 92 }
93 93
94 ASSERT(NULL != m_pCalendarFont); 94 ASSERT(m_pCalendarFont);
95 FWLTHEME_Init(); 95 FWLTHEME_Init();
96 return FWL_Error::Succeeded; 96 return FWL_Error::Succeeded;
97 } 97 }
98 FWL_Error CXFA_FWLTheme::Finalize() { 98 FWL_Error CXFA_FWLTheme::Finalize() {
99 m_pTextOut.reset(); 99 m_pTextOut.reset();
100 if (m_pCalendarFont) { 100 if (m_pCalendarFont) {
101 m_pCalendarFont->Release(); 101 m_pCalendarFont->Release();
102 m_pCalendarFont = nullptr; 102 m_pCalendarFont = nullptr;
103 } 103 }
104 FWLTHEME_Release(); 104 FWLTHEME_Release();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (pWidget) { 228 if (pWidget) {
229 CXFA_LayoutItem* pItem = pWidget; 229 CXFA_LayoutItem* pItem = pWidget;
230 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); 230 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
231 pWidgetAcc->GetUIMargin(m_Rect); 231 pWidgetAcc->GetUIMargin(m_Rect);
232 if (CXFA_Para para = pWidgetAcc->GetPara()) { 232 if (CXFA_Para para = pWidgetAcc->GetPara()) {
233 m_Rect.left += para.GetMarginLeft(); 233 m_Rect.left += para.GetMarginLeft();
234 if (pWidgetAcc->IsMultiLine()) { 234 if (pWidgetAcc->IsMultiLine()) {
235 m_Rect.width += para.GetMarginRight(); 235 m_Rect.width += para.GetMarginRight();
236 } 236 }
237 } 237 }
238 if (pItem->GetPrev() == NULL) { 238 if (!pItem->GetPrev()) {
239 if (pItem->GetNext()) { 239 if (pItem->GetNext()) {
240 m_Rect.height = 0; 240 m_Rect.height = 0;
241 } 241 }
242 } else if (pItem->GetNext() == NULL) { 242 } else if (!pItem->GetNext()) {
243 m_Rect.top = 0; 243 m_Rect.top = 0;
244 } else { 244 } else {
245 m_Rect.top = 0; 245 m_Rect.top = 0;
246 m_Rect.height = 0; 246 m_Rect.height = 0;
247 } 247 }
248 } 248 }
249 return &m_Rect; 249 return &m_Rect;
250 } break; 250 } break;
251 case CFWL_WidgetCapacity::SpaceAboveBelow: { 251 case CFWL_WidgetCapacity::SpaceAboveBelow: {
252 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); 252 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 } 479 }
480 } 480 }
481 CFX_Color crLine(cr); 481 CFX_Color crLine(cr);
482 pParams->m_pGraphics->SetStrokeColor(&crLine); 482 pParams->m_pGraphics->SetStrokeColor(&crLine);
483 pParams->m_pGraphics->SetLineWidth(fWidth); 483 pParams->m_pGraphics->SetLineWidth(fWidth);
484 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); 484 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix);
485 return TRUE; 485 return TRUE;
486 } 486 }
487 return CFWL_EditTP::DrawBackground(pParams); 487 return CFWL_EditTP::DrawBackground(pParams);
488 } 488 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fontmgr.cpp ('k') | xfa/fxfa/app/xfa_textlayout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698