| OLD | NEW |
| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 FX_BOOL bChildren) { | 120 FX_BOOL bChildren) { |
| 121 return 0; | 121 return 0; |
| 122 } | 122 } |
| 123 FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { | 123 FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { |
| 124 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); | 124 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); |
| 125 } | 125 } |
| 126 FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { | 126 FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { |
| 127 if (pParams->m_wsText.IsEmpty()) { | 127 if (pParams->m_wsText.IsEmpty()) { |
| 128 return FWL_ERR_Indefinite; | 128 return FWL_ERR_Indefinite; |
| 129 } | 129 } |
| 130 if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { | 130 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { |
| 131 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 131 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
| 132 if (!pWidget) { | 132 if (!pWidget) { |
| 133 return FWL_ERR_Indefinite; | 133 return FWL_ERR_Indefinite; |
| 134 } | 134 } |
| 135 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 135 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
| 136 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 136 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 137 m_pTextOut->SetFont(m_pCalendarFont); | 137 m_pTextOut->SetFont(m_pCalendarFont); |
| 138 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); | 138 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); |
| 139 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); | 139 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); |
| 140 if ((pParams->m_iPart == CFWL_Part::DatesIn) && | 140 if ((pParams->m_iPart == CFWL_Part::DatesIn) && |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 m_SizeAboveBelow.y = para.GetSpaceBelow(); | 258 m_SizeAboveBelow.y = para.GetSpaceBelow(); |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 return &m_SizeAboveBelow; | 261 return &m_SizeAboveBelow; |
| 262 } break; | 262 } break; |
| 263 default: | 263 default: |
| 264 break; | 264 break; |
| 265 } | 265 } |
| 266 | 266 |
| 267 int dwCapValue = static_cast<int>(dwCapacity); | 267 int dwCapValue = static_cast<int>(dwCapacity); |
| 268 if (pThemePart->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar && | 268 if (pThemePart->m_pWidget->GetClassID() == FWL_Type::MonthCalendar && |
| 269 dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) && | 269 dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) && |
| 270 dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) { | 270 dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) { |
| 271 if (CXFA_FFWidget* pWidget = | 271 if (CXFA_FFWidget* pWidget = |
| 272 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { | 272 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { |
| 273 IXFA_AppProvider* pAppProvider = pWidget->GetAppProvider(); | 273 IXFA_AppProvider* pAppProvider = pWidget->GetAppProvider(); |
| 274 m_wsResource.clear(); | 274 m_wsResource.clear(); |
| 275 switch (dwCapacity) { | 275 switch (dwCapacity) { |
| 276 case CFWL_WidgetCapacity::Sun: | 276 case CFWL_WidgetCapacity::Sun: |
| 277 pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sun, m_wsResource); | 277 pAppProvider->LoadString(XFA_IDS_StringWeekDay_Sun, m_wsResource); |
| 278 break; | 278 break; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 FWL_ERR CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) { | 348 FWL_ERR CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) { |
| 349 CFX_RectF rect; | 349 CFX_RectF rect; |
| 350 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rect); | 350 return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rect); |
| 351 } | 351 } |
| 352 FX_BOOL CXFA_FWLTheme::IsInPart(CFWL_ThemePart* pThemePart, | 352 FX_BOOL CXFA_FWLTheme::IsInPart(CFWL_ThemePart* pThemePart, |
| 353 FX_FLOAT fx, | 353 FX_FLOAT fx, |
| 354 FX_FLOAT fy) { | 354 FX_FLOAT fy) { |
| 355 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); | 355 return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); |
| 356 } | 356 } |
| 357 FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { | 357 FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { |
| 358 if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { | 358 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { |
| 359 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 359 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
| 360 if (!pWidget) { | 360 if (!pWidget) { |
| 361 return FWL_ERR_Indefinite; | 361 return FWL_ERR_Indefinite; |
| 362 } | 362 } |
| 363 if (!pParams) | 363 if (!pParams) |
| 364 return FALSE; | 364 return FALSE; |
| 365 if (!m_pTextOut) | 365 if (!m_pTextOut) |
| 366 return FALSE; | 366 return FALSE; |
| 367 m_pTextOut->SetFont(m_pCalendarFont); | 367 m_pTextOut->SetFont(m_pCalendarFont); |
| 368 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); | 368 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 386 if (!m_pTextOut) | 386 if (!m_pTextOut) |
| 387 return FALSE; | 387 return FALSE; |
| 388 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 388 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 389 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 389 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
| 390 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), | 390 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), |
| 391 pParams->m_wsText.GetLength(), rect); | 391 pParams->m_wsText.GetLength(), rect); |
| 392 return TRUE; | 392 return TRUE; |
| 393 } | 393 } |
| 394 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { | 394 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { |
| 395 switch (pWidget->GetClassID()) { | 395 switch (pWidget->GetClassID()) { |
| 396 case FWL_CLASSHASH_CheckBox: | 396 case FWL_Type::CheckBox: |
| 397 return m_pCheckBoxTP; | 397 return m_pCheckBoxTP; |
| 398 case FWL_CLASSHASH_ListBox: | 398 case FWL_Type::ListBox: |
| 399 return m_pListBoxTP; | 399 return m_pListBoxTP; |
| 400 case FWL_CLASSHASH_PictureBox: | 400 case FWL_Type::PictureBox: |
| 401 return m_pPictureBoxTP; | 401 return m_pPictureBoxTP; |
| 402 case FWL_CLASSHASH_ScrollBar: | 402 case FWL_Type::ScrollBar: |
| 403 return m_pSrollBarTP; | 403 return m_pSrollBarTP; |
| 404 case FWL_CLASSHASH_Edit: | 404 case FWL_Type::Edit: |
| 405 return m_pEditTP; | 405 return m_pEditTP; |
| 406 case FWL_CLASSHASH_ComboBox: | 406 case FWL_Type::ComboBox: |
| 407 return m_pComboBoxTP; | 407 return m_pComboBoxTP; |
| 408 case FWL_CLASSHASH_MonthCalendar: | 408 case FWL_Type::MonthCalendar: |
| 409 return m_pMonthCalendarTP; | 409 return m_pMonthCalendarTP; |
| 410 case FWL_CLASSHASH_DateTimePicker: | 410 case FWL_Type::DateTimePicker: |
| 411 return m_pDateTimePickerTP; | 411 return m_pDateTimePickerTP; |
| 412 case FWL_CLASSHASH_PushButton: | 412 case FWL_Type::PushButton: |
| 413 return m_pPushButtonTP; | 413 return m_pPushButtonTP; |
| 414 case FWL_CLASSHASH_Caret: | 414 case FWL_Type::Caret: |
| 415 return m_pCaretTP; | 415 return m_pCaretTP; |
| 416 case FWL_CLASSHASH_Barcode: | 416 case FWL_Type::Barcode: |
| 417 return m_pBarcodeTP; | 417 return m_pBarcodeTP; |
| 418 default: | 418 default: |
| 419 break; | 419 return nullptr; |
| 420 } | 420 } |
| 421 return NULL; | |
| 422 } | 421 } |
| 423 CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {} | 422 CXFA_FWLCheckBoxTP::CXFA_FWLCheckBoxTP() {} |
| 424 FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 423 FX_BOOL CXFA_FWLCheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
| 425 if (pParams->m_iPart != CFWL_Part::CheckBox) { | 424 if (pParams->m_iPart != CFWL_Part::CheckBox) { |
| 426 return TRUE; | 425 return TRUE; |
| 427 } | 426 } |
| 428 if ((pParams->m_dwStates & CFWL_PartState_Checked) || | 427 if ((pParams->m_dwStates & CFWL_PartState_Checked) || |
| 429 (pParams->m_dwStates & CFWL_PartState_Neutral)) { | 428 (pParams->m_dwStates & CFWL_PartState_Neutral)) { |
| 430 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, | 429 DrawCheckSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, |
| 431 pParams->m_dwStates, &pParams->m_matrix); | 430 pParams->m_dwStates, &pParams->m_matrix); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 } | 483 } |
| 485 } | 484 } |
| 486 CFX_Color crLine(cr); | 485 CFX_Color crLine(cr); |
| 487 pParams->m_pGraphics->SetStrokeColor(&crLine); | 486 pParams->m_pGraphics->SetStrokeColor(&crLine); |
| 488 pParams->m_pGraphics->SetLineWidth(fWidth); | 487 pParams->m_pGraphics->SetLineWidth(fWidth); |
| 489 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); | 488 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); |
| 490 return TRUE; | 489 return TRUE; |
| 491 } | 490 } |
| 492 return CFWL_EditTP::DrawBackground(pParams); | 491 return CFWL_EditTP::DrawBackground(pParams); |
| 493 } | 492 } |
| OLD | NEW |