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

Side by Side Diff: xfa/fxfa/app/xfa_fwltheme.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, 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 28 matching lines...) Expand all
39 while (pOuter && pOuter->GetOuter()) 39 while (pOuter && pOuter->GetOuter())
40 pOuter = pOuter->GetOuter(); 40 pOuter = pOuter->GetOuter();
41 41
42 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem()) 42 return pOuter ? static_cast<CXFA_FFWidget*>(pOuter->GetLayoutItem())
43 : nullptr; 43 : nullptr;
44 } 44 }
45 45
46 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) { 46 CXFA_FWLTheme::CXFA_FWLTheme(CXFA_FFApp* pApp) : m_pApp(pApp) {
47 m_dwCapacity = 0; 47 m_dwCapacity = 0;
48 m_fCapacity = 0; 48 m_fCapacity = 0;
49 m_pCalendarFont = NULL; 49 m_pCalendarFont = nullptr;
50 m_Rect.Set(0, 0, 0, 0); 50 m_Rect.Set(0, 0, 0, 0);
51 m_pCheckBoxTP = new CXFA_FWLCheckBoxTP; 51 m_pCheckBoxTP = new CXFA_FWLCheckBoxTP;
52 m_pListBoxTP = new CFWL_ListBoxTP; 52 m_pListBoxTP = new CFWL_ListBoxTP;
53 m_pPictureBoxTP = new CFWL_PictureBoxTP; 53 m_pPictureBoxTP = new CFWL_PictureBoxTP;
54 m_pSrollBarTP = new CFWL_ScrollBarTP; 54 m_pSrollBarTP = new CFWL_ScrollBarTP;
55 m_pEditTP = new CXFA_FWLEditTP; 55 m_pEditTP = new CXFA_FWLEditTP;
56 m_pComboBoxTP = new CFWL_ComboBoxTP; 56 m_pComboBoxTP = new CFWL_ComboBoxTP;
57 m_pMonthCalendarTP = new CFWL_MonthCalendarTP; 57 m_pMonthCalendarTP = new CFWL_MonthCalendarTP;
58 m_pDateTimePickerTP = new CFWL_DateTimePickerTP; 58 m_pDateTimePickerTP = new CFWL_DateTimePickerTP;
59 m_pPushButtonTP = new CFWL_PushButtonTP; 59 m_pPushButtonTP = new CFWL_PushButtonTP;
(...skipping 18 matching lines...) Expand all
78 FWL_Error CXFA_FWLTheme::Initialize() { 78 FWL_Error CXFA_FWLTheme::Initialize() {
79 m_pTextOut.reset(new CFDE_TextOut); 79 m_pTextOut.reset(new CFDE_TextOut);
80 for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); 80 for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts);
81 ++i) { 81 ++i) {
82 m_pCalendarFont = CFGAS_GEFont::LoadFont(g_FWLTheme_CalFonts[i], 0, 0, 82 m_pCalendarFont = CFGAS_GEFont::LoadFont(g_FWLTheme_CalFonts[i], 0, 0,
83 m_pApp->GetFDEFontMgr()); 83 m_pApp->GetFDEFontMgr());
84 } 84 }
85 if (!m_pCalendarFont) { 85 if (!m_pCalendarFont) {
86 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 86 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
87 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage( 87 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage(
88 FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); 88 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr);
89 #else 89 #else
90 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( 90 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage(
91 FX_CODEPAGE_MSWin_WesternEuropean, 0, NULL); 91 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr);
92 #endif 92 #endif
93 } 93 }
94 94
95 ASSERT(NULL != m_pCalendarFont); 95 ASSERT(m_pCalendarFont);
96 FWLTHEME_Init(); 96 FWLTHEME_Init();
97 return FWL_Error::Succeeded; 97 return FWL_Error::Succeeded;
98 } 98 }
99 FWL_Error CXFA_FWLTheme::Finalize() { 99 FWL_Error CXFA_FWLTheme::Finalize() {
100 m_pTextOut.reset(); 100 m_pTextOut.reset();
101 if (m_pCalendarFont) { 101 if (m_pCalendarFont) {
102 m_pCalendarFont->Release(); 102 m_pCalendarFont->Release();
103 m_pCalendarFont = nullptr; 103 m_pCalendarFont = nullptr;
104 } 104 }
105 FWLTHEME_Release(); 105 FWLTHEME_Release();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (pWidget) { 239 if (pWidget) {
240 CXFA_LayoutItem* pItem = pWidget; 240 CXFA_LayoutItem* pItem = pWidget;
241 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); 241 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
242 pWidgetAcc->GetUIMargin(m_Rect); 242 pWidgetAcc->GetUIMargin(m_Rect);
243 if (CXFA_Para para = pWidgetAcc->GetPara()) { 243 if (CXFA_Para para = pWidgetAcc->GetPara()) {
244 m_Rect.left += para.GetMarginLeft(); 244 m_Rect.left += para.GetMarginLeft();
245 if (pWidgetAcc->IsMultiLine()) { 245 if (pWidgetAcc->IsMultiLine()) {
246 m_Rect.width += para.GetMarginRight(); 246 m_Rect.width += para.GetMarginRight();
247 } 247 }
248 } 248 }
249 if (pItem->GetPrev() == NULL) { 249 if (!pItem->GetPrev()) {
250 if (pItem->GetNext()) { 250 if (pItem->GetNext()) {
251 m_Rect.height = 0; 251 m_Rect.height = 0;
252 } 252 }
253 } else if (pItem->GetNext() == NULL) { 253 } else if (!pItem->GetNext()) {
254 m_Rect.top = 0; 254 m_Rect.top = 0;
255 } else { 255 } else {
256 m_Rect.top = 0; 256 m_Rect.top = 0;
257 m_Rect.height = 0; 257 m_Rect.height = 0;
258 } 258 }
259 } 259 }
260 return &m_Rect; 260 return &m_Rect;
261 } break; 261 } break;
262 case CFWL_WidgetCapacity::SpaceAboveBelow: { 262 case CFWL_WidgetCapacity::SpaceAboveBelow: {
263 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); 263 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 495 }
496 } 496 }
497 CFX_Color crLine(cr); 497 CFX_Color crLine(cr);
498 pParams->m_pGraphics->SetStrokeColor(&crLine); 498 pParams->m_pGraphics->SetStrokeColor(&crLine);
499 pParams->m_pGraphics->SetLineWidth(fWidth); 499 pParams->m_pGraphics->SetLineWidth(fWidth);
500 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); 500 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix);
501 return TRUE; 501 return TRUE;
502 } 502 }
503 return CFWL_EditTP::DrawBackground(pParams); 503 return CFWL_EditTP::DrawBackground(pParams);
504 } 504 }
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