summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-02 17:17:02 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-03 19:54:37 +0000
commitc8fd3318a8deca3e1eabd6f7a9449ae4a0fa964d (patch)
treea5aedd888a3981f53722b7d65ea969d246f267c8 /xfa/fwl
parentdb194cf018069b930d0e3d5fc0242e14f70e8620 (diff)
downloadpdfium-c8fd3318a8deca3e1eabd6f7a9449ae4a0fa964d.tar.xz
Cleaning out params in CPDFXFA_Context
This CL cleans up some of the out params in CPDFXFA_Context. In the process several of the strings returned by ::LoadString() are inlined in their call sites and the defines removed. BUG=pdfium:549 Change-Id: I41a7ceeba3962299eecd0cb714ddb03d28dbb0ea Reviewed-on: https://pdfium-review.googlesource.com/2134 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/cfwl_monthcalendar.cpp140
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.cpp80
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h22
3 files changed, 49 insertions, 193 deletions
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index 3b8076bb5f..6487262991 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -31,92 +31,54 @@
namespace {
-CFX_WideString* GetCapacityForDay(IFWL_ThemeProvider* pTheme,
- CFWL_ThemePart& params,
- uint32_t day) {
+CFX_WideString GetCapacityForDay(IFWL_ThemeProvider* pTheme,
+ CFWL_ThemePart& params,
+ uint32_t day) {
ASSERT(day < 7);
- if (day == 0) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Sun));
- }
- if (day == 1) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Mon));
- }
- if (day == 2) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Tue));
- }
- if (day == 3) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Wed));
- }
- if (day == 4) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Thu));
- }
- if (day == 5) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Fri));
- }
-
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Sat));
-}
-
-CFX_WideString* GetCapacityForMonth(IFWL_ThemeProvider* pTheme,
- CFWL_ThemePart& params,
- uint32_t month) {
+ if (day == 0)
+ return L"Sun";
+ if (day == 1)
+ return L"Mon";
+ if (day == 2)
+ return L"Tue";
+ if (day == 3)
+ return L"Wed";
+ if (day == 4)
+ return L"Thu";
+ if (day == 5)
+ return L"Fri";
+ return L"Sat";
+}
+
+CFX_WideString GetCapacityForMonth(IFWL_ThemeProvider* pTheme,
+ CFWL_ThemePart& params,
+ uint32_t month) {
ASSERT(month < 12);
- if (month == 0) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::January));
- }
- if (month == 1) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::February));
- }
- if (month == 2) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::March));
- }
- if (month == 3) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::April));
- }
- if (month == 4) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::May));
- }
- if (month == 5) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::June));
- }
- if (month == 6) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::July));
- }
- if (month == 7) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::August));
- }
- if (month == 8) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::September));
- }
- if (month == 9) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::October));
- }
- if (month == 10) {
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::November));
- }
-
- return static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::December));
+ if (month == 0)
+ return L"January";
+ if (month == 1)
+ return L"February";
+ if (month == 2)
+ return L"March";
+ if (month == 3)
+ return L"April";
+ if (month == 4)
+ return L"May";
+ if (month == 5)
+ return L"June";
+ if (month == 6)
+ return L"July";
+ if (month == 7)
+ return L"August";
+ if (month == 8)
+ return L"September";
+ if (month == 9)
+ return L"October";
+ if (month == 10)
+ return L"November";
+ return L"December";
}
} // namespace
@@ -360,7 +322,7 @@ void CFWL_MonthCalendar::DrawWeek(CFX_Graphics* pGraphics,
rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2),
m_rtWeek.top, m_szCell.x, m_szCell.y);
params.m_rtPart = rtDayOfWeek;
- params.m_wsText = *GetCapacityForDay(pTheme, params, i);
+ params.m_wsText = GetCapacityForDay(pTheme, params, i);
params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
pTheme->DrawText(&params);
}
@@ -376,11 +338,9 @@ void CFWL_MonthCalendar::DrawToday(CFX_Graphics* pGraphics,
params.m_dwStates = CFWL_PartState_Normal;
params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft;
- CFX_WideString* wsDay = static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Today));
CFX_WideString wsText;
GetTodayText(m_iYear, m_iMonth, m_iDay, wsText);
- params.m_wsText = *wsDay + wsText;
+ params.m_wsText = L"Today" + wsText;
m_szToday =
CalcTextSize(params.m_wsText, m_pProperties->m_pThemeProvider, false);
@@ -466,7 +426,7 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() {
FX_FLOAT fMaxWeekH = 0.0f;
for (uint32_t i = 0; i < 7; ++i) {
- CFX_SizeF sz = CalcTextSize(*GetCapacityForDay(pTheme, params, i),
+ CFX_SizeF sz = CalcTextSize(GetCapacityForDay(pTheme, params, i),
m_pProperties->m_pThemeProvider, false);
fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x;
fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y;
@@ -491,7 +451,7 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() {
FX_FLOAT fMonthMaxH = 0.0f;
for (uint32_t i = 0; i < 12; ++i) {
- CFX_SizeF sz = CalcTextSize(*GetCapacityForMonth(pTheme, params, i),
+ CFX_SizeF sz = CalcTextSize(GetCapacityForMonth(pTheme, params, i),
m_pProperties->m_pThemeProvider, false);
fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x;
fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y;
@@ -509,9 +469,7 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() {
CFX_WideString wsToday;
GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday);
- CFX_WideString* wsText = static_cast<CFX_WideString*>(
- pTheme->GetCapacity(&params, CFWL_WidgetCapacity::Today));
- m_wsToday = *wsText + wsToday;
+ m_wsToday = L"Today" + wsToday;
m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider, false);
m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y;
fs.y = m_szCell.x + m_szCell.y * (MONTHCAL_ROWS - 2) + m_szToday.y +
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index 13fabb34e5..a76d959cca 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -248,86 +248,6 @@ void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart,
m_fValue = kHeight;
break;
}
- case CFWL_WidgetCapacity::Sun: {
- wsResource = L"Sun";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::Mon: {
- wsResource = L"Mon";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::Tue: {
- wsResource = L"Tue";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::Wed: {
- wsResource = L"Wed";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::Thu: {
- wsResource = L"Thu";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::Fri: {
- wsResource = L"Fri";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::Sat: {
- wsResource = L"Sat";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::January: {
- wsResource = L"January";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::February: {
- wsResource = L"February";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::March: {
- wsResource = L"March";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::April: {
- wsResource = L"April";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::May: {
- wsResource = L"May";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::June: {
- wsResource = L"June";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::July: {
- wsResource = L"July";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::August: {
- wsResource = L"August";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::September: {
- wsResource = L"September";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::October: {
- wsResource = L"October";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::November: {
- wsResource = L"November";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::December: {
- wsResource = L"December";
- return &wsResource;
- }
- case CFWL_WidgetCapacity::Today: {
- wsResource = L"Today";
- return &wsResource;
- }
default:
bDefPro = true;
break;
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 90d697379c..11135121c0 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -19,28 +19,6 @@
enum class CFWL_WidgetCapacity {
None = 0,
- Today,
- Sun,
- Mon,
- Tue,
- Wed,
- Thu,
- Fri,
- Sat,
-
- January,
- February,
- March,
- April,
- May,
- June,
- July,
- August,
- September,
- October,
- November,
- December,
-
BigIcon,
ComboFormHandler,
CXBorder,