diff options
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/cfwl_checkbox.cpp | 11 | ||||
-rw-r--r-- | xfa/fwl/cfwl_checkbox.h | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_combobox.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_listbox.cpp | 11 | ||||
-rw-r--r-- | xfa/fwl/cfwl_listbox.h | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_monthcalendar.cpp | 21 | ||||
-rw-r--r-- | xfa/fwl/cfwl_pushbutton.cpp | 10 | ||||
-rw-r--r-- | xfa/fwl/cfwl_pushbutton.h | 2 | ||||
-rw-r--r-- | xfa/fwl/cfwl_themetext.h | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widget.cpp | 13 | ||||
-rw-r--r-- | xfa/fwl/cfwl_widget.h | 5 |
11 files changed, 43 insertions, 46 deletions
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp index eed201ba34..bc45e5a792 100644 --- a/xfa/fwl/cfwl_checkbox.cpp +++ b/xfa/fwl/cfwl_checkbox.cpp @@ -31,10 +31,10 @@ const int kCaptionMargin = 5; CFWL_CheckBox::CFWL_CheckBox(const CFWL_App* app) : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr), - m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), - m_iTTOAlign(FDE_TTOALIGNMENT_Center), + m_iTTOAlign(FDE_TextAlignment::kCenter), m_bBtnDown(false), m_fBoxHeight(16.0f) { + m_dwTTOStyles.single_line_ = true; m_rtClient.Reset(); m_rtBox.Reset(); m_rtCaption.Reset(); @@ -170,9 +170,10 @@ uint32_t CFWL_CheckBox::GetPartStates() const { } void CFWL_CheckBox::UpdateTextOutStyles() { - m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; - m_dwTTOStyles = 0; - m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; + m_iTTOAlign = FDE_TextAlignment::kTopLeft; + + m_dwTTOStyles.Reset(); + m_dwTTOStyles.single_line_ = true; } void CFWL_CheckBox::NextStates() { diff --git a/xfa/fwl/cfwl_checkbox.h b/xfa/fwl/cfwl_checkbox.h index 6fc9033dee..e90fbd1b93 100644 --- a/xfa/fwl/cfwl_checkbox.h +++ b/xfa/fwl/cfwl_checkbox.h @@ -66,8 +66,8 @@ class CFWL_CheckBox : public CFWL_Widget { CFX_RectF m_rtBox; CFX_RectF m_rtCaption; CFX_RectF m_rtFocus; - uint32_t m_dwTTOStyles; - int32_t m_iTTOAlign; + FDE_TextStyle m_dwTTOStyles; + FDE_TextAlignment m_iTTOAlign; bool m_bBtnDown; float m_fBoxHeight; }; diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp index acc72b0e64..ec90a15684 100644 --- a/xfa/fwl/cfwl_combobox.cpp +++ b/xfa/fwl/cfwl_combobox.cpp @@ -180,8 +180,8 @@ void CFWL_ComboBox::DrawWidget(CXFA_Graphics* pGraphics, ? CFWL_PartState_Selected : CFWL_PartState_Normal; theme_text.m_wsText = hItem ? hItem->GetText() : L""; - theme_text.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; - theme_text.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; + theme_text.m_dwTTOStyles.single_line_ = true; + theme_text.m_iTTOAlign = FDE_TextAlignment::kCenterLeft; pTheme->DrawText(&theme_text); } } diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp index ddad4038f5..d0455ff650 100644 --- a/xfa/fwl/cfwl_listbox.cpp +++ b/xfa/fwl/cfwl_listbox.cpp @@ -32,8 +32,7 @@ CFWL_ListBox::CFWL_ListBox(const CFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties, CFWL_Widget* pOuter) : CFWL_Widget(app, std::move(properties), pOuter), - m_dwTTOStyles(0), - m_iTTOAligns(0), + m_iTTOAligns(FDE_TextAlignment::kTopLeft), m_hAnchor(nullptr), m_fScorllBarWidth(0), m_bLButtonDown(false), @@ -57,20 +56,20 @@ void CFWL_ListBox::Update() { switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_AlignMask) { case FWL_STYLEEXT_LTB_LeftAlign: { - m_iTTOAligns = FDE_TTOALIGNMENT_CenterLeft; + m_iTTOAligns = FDE_TextAlignment::kCenterLeft; break; } case FWL_STYLEEXT_LTB_RightAlign: { - m_iTTOAligns = FDE_TTOALIGNMENT_CenterRight; + m_iTTOAligns = FDE_TextAlignment::kCenterRight; break; } case FWL_STYLEEXT_LTB_CenterAlign: default: { - m_iTTOAligns = FDE_TTOALIGNMENT_Center; + m_iTTOAligns = FDE_TextAlignment::kCenter; break; } } - m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; + m_dwTTOStyles.single_line_ = true; m_fScorllBarWidth = GetScrollWidth(); CalcSize(false); } diff --git a/xfa/fwl/cfwl_listbox.h b/xfa/fwl/cfwl_listbox.h index 4f934432d6..e98f21b464 100644 --- a/xfa/fwl/cfwl_listbox.h +++ b/xfa/fwl/cfwl_listbox.h @@ -122,8 +122,8 @@ class CFWL_ListBox : public CFWL_Widget { CFX_RectF m_rtConent; std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar; std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar; - uint32_t m_dwTTOStyles; - int32_t m_iTTOAligns; + FDE_TextStyle m_dwTTOStyles; + FDE_TextAlignment m_iTTOAligns; CFWL_ListItem* m_hAnchor; float m_fItemHeight; float m_fScorllBarWidth; diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 8c770e545b..64e6977924 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -247,8 +247,8 @@ void CFWL_MonthCalendar::DrawCaption(CXFA_Graphics* pGraphics, CalcTextSize(textParam.m_wsText, m_pProperties->m_pThemeProvider, false); CalcHeadSize(); textParam.m_rtPart = m_rtHeadText; - textParam.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; - textParam.m_iTTOAlign = FDE_TTOALIGNMENT_Center; + textParam.m_dwTTOStyles.single_line_ = true; + textParam.m_iTTOAlign = FDE_TextAlignment::kCenter; if (pMatrix) textParam.m_matrix.Concat(*pMatrix); pTheme->DrawText(&textParam); @@ -306,7 +306,9 @@ void CFWL_MonthCalendar::DrawWeek(CXFA_Graphics* pGraphics, params.m_iPart = CFWL_Part::Week; params.m_pGraphics = pGraphics; params.m_dwStates = CFWL_PartState_Normal; - params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; + params.m_iTTOAlign = FDE_TextAlignment::kCenter; + params.m_dwTTOStyles.single_line_ = true; + CFX_RectF rtDayOfWeek; if (pMatrix) params.m_matrix.Concat(*pMatrix); @@ -318,7 +320,6 @@ void CFWL_MonthCalendar::DrawWeek(CXFA_Graphics* pGraphics, params.m_rtPart = rtDayOfWeek; params.m_wsText = GetCapacityForDay(pTheme, params, i); - params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; pTheme->DrawText(¶ms); } } @@ -331,14 +332,15 @@ void CFWL_MonthCalendar::DrawToday(CXFA_Graphics* pGraphics, params.m_iPart = CFWL_Part::Today; params.m_pGraphics = pGraphics; params.m_dwStates = CFWL_PartState_Normal; - params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft; + params.m_iTTOAlign = FDE_TextAlignment::kCenterLeft; params.m_wsText = L"Today" + GetTodayText(m_iYear, m_iMonth, m_iDay); m_szToday = CalcTextSize(params.m_wsText, m_pProperties->m_pThemeProvider, false); CalcTodaySize(); params.m_rtPart = m_rtToday; - params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; + params.m_dwTTOStyles.single_line_ = true; + if (pMatrix) params.m_matrix.Concat(*pMatrix); pTheme->DrawText(¶ms); @@ -352,7 +354,7 @@ void CFWL_MonthCalendar::DrawDatesIn(CXFA_Graphics* pGraphics, params.m_iPart = CFWL_Part::DatesIn; params.m_pGraphics = pGraphics; params.m_dwStates = CFWL_PartState_Normal; - params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; + params.m_iTTOAlign = FDE_TextAlignment::kCenter; if (pMatrix) params.m_matrix.Concat(*pMatrix); @@ -364,7 +366,8 @@ void CFWL_MonthCalendar::DrawDatesIn(CXFA_Graphics* pGraphics, params.m_dwStates = pDataInfo->dwStates; if (j + 1 == m_iHovered) params.m_dwStates |= CFWL_PartState_Hovered; - params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; + + params.m_dwTTOStyles.single_line_ = true; pTheme->DrawText(¶ms); } } @@ -377,7 +380,7 @@ void CFWL_MonthCalendar::DrawDatesOut(CXFA_Graphics* pGraphics, params.m_iPart = CFWL_Part::DatesOut; params.m_pGraphics = pGraphics; params.m_dwStates = CFWL_PartState_Normal; - params.m_iTTOAlign = FDE_TTOALIGNMENT_Center; + params.m_iTTOAlign = FDE_TextAlignment::kCenter; if (pMatrix) params.m_matrix.Concat(*pMatrix); pTheme->DrawText(¶ms); diff --git a/xfa/fwl/cfwl_pushbutton.cpp b/xfa/fwl/cfwl_pushbutton.cpp index 382748df53..1dfe2db2fd 100644 --- a/xfa/fwl/cfwl_pushbutton.cpp +++ b/xfa/fwl/cfwl_pushbutton.cpp @@ -22,9 +22,7 @@ CFWL_PushButton::CFWL_PushButton(const CFWL_App* app) : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr), - m_bBtnDown(false), - m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), - m_iTTOAlign(FDE_TTOALIGNMENT_Center) {} + m_bBtnDown(false) {} CFWL_PushButton::~CFWL_PushButton() {} @@ -46,7 +44,6 @@ void CFWL_PushButton::Update() { if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); - UpdateTextOutStyles(); m_rtClient = GetClientRect(); m_rtCaption = m_rtClient; } @@ -94,11 +91,6 @@ uint32_t CFWL_PushButton::GetPartStates() { return dwStates; } -void CFWL_PushButton::UpdateTextOutStyles() { - m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; - m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; -} - void CFWL_PushButton::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; diff --git a/xfa/fwl/cfwl_pushbutton.h b/xfa/fwl/cfwl_pushbutton.h index 196c53763f..84019ba181 100644 --- a/xfa/fwl/cfwl_pushbutton.h +++ b/xfa/fwl/cfwl_pushbutton.h @@ -49,8 +49,6 @@ class CFWL_PushButton : public CFWL_Widget { CFX_RectF m_rtClient; CFX_RectF m_rtCaption; bool m_bBtnDown; - uint32_t m_dwTTOStyles; - int32_t m_iTTOAlign; }; #endif // XFA_FWL_CFWL_PUSHBUTTON_H_ diff --git a/xfa/fwl/cfwl_themetext.h b/xfa/fwl/cfwl_themetext.h index 7c8330e04e..2a42615d6f 100644 --- a/xfa/fwl/cfwl_themetext.h +++ b/xfa/fwl/cfwl_themetext.h @@ -16,8 +16,8 @@ class CFWL_ThemeText : public CFWL_ThemePart { CFWL_ThemeText() : m_pGraphics(nullptr) {} CFX_WideString m_wsText; - uint32_t m_dwTTOStyles; - int32_t m_iTTOAlign; + FDE_TextStyle m_dwTTOStyles; + FDE_TextAlignment m_iTTOAlign; CXFA_Graphics* m_pGraphics; }; diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp index a2c270c332..8b8bf5d3cd 100644 --- a/xfa/fwl/cfwl_widget.cpp +++ b/xfa/fwl/cfwl_widget.cpp @@ -324,9 +324,12 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, CFWL_ThemeText calPart; calPart.m_pWidget = this; calPart.m_wsText = wsText; - calPart.m_dwTTOStyles = - bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine; - calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; + if (bMultiLine) + calPart.m_dwTTOStyles.line_wrap_ = true; + else + calPart.m_dwTTOStyles.single_line_ = true; + + calPart.m_iTTOAlign = FDE_TextAlignment::kTopLeft; float fWidth = bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth; CFX_RectF rect(0, 0, fWidth, FWL_WGT_CalcHeight); pTheme->CalcTextRect(&calPart, rect); @@ -335,8 +338,8 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, void CFWL_Widget::CalcTextRect(const CFX_WideString& wsText, IFWL_ThemeProvider* pTheme, - uint32_t dwTTOStyles, - int32_t iTTOAlign, + const FDE_TextStyle& dwTTOStyles, + FDE_TextAlignment iTTOAlign, CFX_RectF& rect) { CFWL_ThemeText calPart; calPart.m_pWidget = this; diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h index 316e6f5404..11b3569dbd 100644 --- a/xfa/fwl/cfwl_widget.h +++ b/xfa/fwl/cfwl_widget.h @@ -12,6 +12,7 @@ #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" +#include "xfa/fde/cfde_textout.h" #include "xfa/fwl/cfwl_event.h" #include "xfa/fwl/cfwl_themepart.h" #include "xfa/fwl/cfwl_widgetmgr.h" @@ -132,8 +133,8 @@ class CFWL_Widget : public IFWL_WidgetDelegate { bool bMultiLine); void CalcTextRect(const CFX_WideString& wsText, IFWL_ThemeProvider* pTheme, - uint32_t dwTTOStyles, - int32_t iTTOAlign, + const FDE_TextStyle& dwTTOStyles, + FDE_TextAlignment iTTOAlign, CFX_RectF& rect); void SetGrab(bool bSet); void GetPopupPos(float fMinHeight, |