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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 m_pListBoxTP(new CFWL_ListBoxTP), | 48 m_pListBoxTP(new CFWL_ListBoxTP), |
49 m_pPictureBoxTP(new CFWL_PictureBoxTP), | 49 m_pPictureBoxTP(new CFWL_PictureBoxTP), |
50 m_pSrollBarTP(new CFWL_ScrollBarTP), | 50 m_pSrollBarTP(new CFWL_ScrollBarTP), |
51 m_pEditTP(new CFWL_EditTP), | 51 m_pEditTP(new CFWL_EditTP), |
52 m_pComboBoxTP(new CFWL_ComboBoxTP), | 52 m_pComboBoxTP(new CFWL_ComboBoxTP), |
53 m_pMonthCalendarTP(new CFWL_MonthCalendarTP), | 53 m_pMonthCalendarTP(new CFWL_MonthCalendarTP), |
54 m_pDateTimePickerTP(new CFWL_DateTimePickerTP), | 54 m_pDateTimePickerTP(new CFWL_DateTimePickerTP), |
55 m_pPushButtonTP(new CFWL_PushButtonTP), | 55 m_pPushButtonTP(new CFWL_PushButtonTP), |
56 m_pCaretTP(new CFWL_CaretTP), | 56 m_pCaretTP(new CFWL_CaretTP), |
57 m_pBarcodeTP(new CFWL_BarcodeTP), | 57 m_pBarcodeTP(new CFWL_BarcodeTP), |
| 58 m_pTextOut(new CFDE_TextOut), |
58 m_fCapacity(0.0f), | 59 m_fCapacity(0.0f), |
59 m_dwCapacity(0), | 60 m_dwCapacity(0), |
60 m_pCalendarFont(nullptr), | 61 m_pCalendarFont(nullptr), |
61 m_pApp(pApp) { | 62 m_pApp(pApp) { |
62 m_Rect.Reset(); | 63 m_Rect.Reset(); |
63 Initialize(); | |
64 } | |
65 | 64 |
66 CXFA_FWLTheme::~CXFA_FWLTheme() { | |
67 Finalize(); | |
68 } | |
69 | |
70 FWL_Error CXFA_FWLTheme::Initialize() { | |
71 m_pTextOut.reset(new CFDE_TextOut); | |
72 for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); | 65 for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); |
73 ++i) { | 66 ++i) { |
74 m_pCalendarFont = CFGAS_GEFont::LoadFont(g_FWLTheme_CalFonts[i], 0, 0, | 67 m_pCalendarFont = CFGAS_GEFont::LoadFont(g_FWLTheme_CalFonts[i], 0, 0, |
75 m_pApp->GetFDEFontMgr()); | 68 m_pApp->GetFDEFontMgr()); |
76 } | 69 } |
77 if (!m_pCalendarFont) { | 70 if (!m_pCalendarFont) { |
78 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 71 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
79 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage( | 72 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetDefFontByCodePage( |
80 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); | 73 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); |
81 #else | 74 #else |
82 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( | 75 m_pCalendarFont = m_pApp->GetFDEFontMgr()->GetFontByCodePage( |
83 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); | 76 FX_CODEPAGE_MSWin_WesternEuropean, 0, nullptr); |
84 #endif | 77 #endif |
85 } | 78 } |
86 | 79 |
87 ASSERT(m_pCalendarFont); | 80 ASSERT(m_pCalendarFont); |
88 return FWL_Error::Succeeded; | |
89 } | 81 } |
90 | 82 |
91 FWL_Error CXFA_FWLTheme::Finalize() { | 83 CXFA_FWLTheme::~CXFA_FWLTheme() { |
92 m_pTextOut.reset(); | 84 m_pTextOut.reset(); |
93 if (m_pCalendarFont) { | 85 if (m_pCalendarFont) { |
94 m_pCalendarFont->Release(); | 86 m_pCalendarFont->Release(); |
95 m_pCalendarFont = nullptr; | 87 m_pCalendarFont = nullptr; |
96 } | 88 } |
97 FWLTHEME_Release(); | 89 FWLTHEME_Release(); |
98 return FWL_Error::Succeeded; | |
99 } | 90 } |
100 | 91 |
101 FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { | 92 void CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { |
102 return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); | 93 GetTheme(pParams->m_pWidget)->DrawBackground(pParams); |
103 } | 94 } |
104 | 95 |
105 FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { | 96 void CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { |
106 if (pParams->m_wsText.IsEmpty()) | 97 if (pParams->m_wsText.IsEmpty()) |
107 return FALSE; | 98 return; |
108 | 99 |
109 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { | 100 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { |
110 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 101 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
111 if (!pWidget) | 102 if (!pWidget) |
112 return FALSE; | 103 return; |
113 | 104 |
114 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 105 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
115 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 106 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
116 m_pTextOut->SetFont(m_pCalendarFont); | 107 m_pTextOut->SetFont(m_pCalendarFont); |
117 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); | 108 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); |
118 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); | 109 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); |
119 if ((pParams->m_iPart == CFWL_Part::DatesIn) && | 110 if ((pParams->m_iPart == CFWL_Part::DatesIn) && |
120 !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) && | 111 !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) && |
121 (pParams->m_dwStates & | 112 (pParams->m_dwStates & |
122 (CFWL_PartState_Hovered | CFWL_PartState_Selected))) { | 113 (CFWL_PartState_Hovered | CFWL_PartState_Selected))) { |
123 m_pTextOut->SetTextColor(0xFFFFFFFF); | 114 m_pTextOut->SetTextColor(0xFFFFFFFF); |
124 } | 115 } |
125 if (pParams->m_iPart == CFWL_Part::Caption) { | 116 if (pParams->m_iPart == CFWL_Part::Caption) { |
126 if (m_pMonthCalendarTP->GetThemeID(pParams->m_pWidget) == 0) { | 117 if (m_pMonthCalendarTP->GetThemeID(pParams->m_pWidget) == 0) { |
127 m_pTextOut->SetTextColor(ArgbEncode(0xff, 0, 153, 255)); | 118 m_pTextOut->SetTextColor(ArgbEncode(0xff, 0, 153, 255)); |
128 } else { | 119 } else { |
129 m_pTextOut->SetTextColor(ArgbEncode(0xff, 128, 128, 0)); | 120 m_pTextOut->SetTextColor(ArgbEncode(0xff, 128, 128, 0)); |
130 } | 121 } |
131 } | 122 } |
132 CFX_Graphics* pGraphics = pParams->m_pGraphics; | 123 CFX_Graphics* pGraphics = pParams->m_pGraphics; |
133 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); | 124 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); |
134 if (!pRenderDevice) | 125 if (!pRenderDevice) |
135 return FALSE; | 126 return; |
| 127 |
136 m_pTextOut->SetRenderDevice(pRenderDevice); | 128 m_pTextOut->SetRenderDevice(pRenderDevice); |
137 CFX_Matrix mtPart = pParams->m_matrix; | 129 CFX_Matrix mtPart = pParams->m_matrix; |
138 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); | 130 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); |
139 if (pMatrix) { | 131 if (pMatrix) { |
140 mtPart.Concat(*pMatrix); | 132 mtPart.Concat(*pMatrix); |
141 } | 133 } |
142 m_pTextOut->SetMatrix(mtPart); | 134 m_pTextOut->SetMatrix(mtPart); |
143 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), | 135 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), |
144 pParams->m_wsText.GetLength(), pParams->m_rtPart); | 136 pParams->m_wsText.GetLength(), pParams->m_rtPart); |
145 return TRUE; | 137 return; |
146 } | 138 } |
147 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 139 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
148 if (!pWidget) | 140 if (!pWidget) |
149 return FALSE; | 141 return; |
150 | 142 |
151 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); | 143 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); |
152 CFX_Graphics* pGraphics = pParams->m_pGraphics; | 144 CFX_Graphics* pGraphics = pParams->m_pGraphics; |
153 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); | 145 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); |
154 if (!pRenderDevice) | 146 if (!pRenderDevice) |
155 return FALSE; | 147 return; |
| 148 |
156 m_pTextOut->SetRenderDevice(pRenderDevice); | 149 m_pTextOut->SetRenderDevice(pRenderDevice); |
157 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 150 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
158 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 151 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
159 m_pTextOut->SetFont(pAcc->GetFDEFont()); | 152 m_pTextOut->SetFont(pAcc->GetFDEFont()); |
160 m_pTextOut->SetFontSize(pAcc->GetFontSize()); | 153 m_pTextOut->SetFontSize(pAcc->GetFontSize()); |
161 m_pTextOut->SetTextColor(pAcc->GetTextColor()); | 154 m_pTextOut->SetTextColor(pAcc->GetTextColor()); |
162 CFX_Matrix mtPart = pParams->m_matrix; | 155 CFX_Matrix mtPart = pParams->m_matrix; |
163 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); | 156 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); |
164 if (pMatrix) { | 157 if (pMatrix) |
165 mtPart.Concat(*pMatrix); | 158 mtPart.Concat(*pMatrix); |
166 } | 159 |
167 m_pTextOut->SetMatrix(mtPart); | 160 m_pTextOut->SetMatrix(mtPart); |
168 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), | 161 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), |
169 pParams->m_wsText.GetLength(), pParams->m_rtPart); | 162 pParams->m_wsText.GetLength(), pParams->m_rtPart); |
170 return TRUE; | |
171 } | 163 } |
172 | 164 |
173 void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, | 165 void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, |
174 CFWL_WidgetCapacity dwCapacity) { | 166 CFWL_WidgetCapacity dwCapacity) { |
175 switch (dwCapacity) { | 167 switch (dwCapacity) { |
176 case CFWL_WidgetCapacity::Font: { | 168 case CFWL_WidgetCapacity::Font: { |
177 if (CXFA_FFWidget* pWidget = | 169 if (CXFA_FFWidget* pWidget = |
178 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { | 170 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { |
179 return pWidget->GetDataAcc()->GetFDEFont(); | 171 return pWidget->GetDataAcc()->GetFDEFont(); |
180 } | 172 } |
181 } break; | 173 break; |
| 174 } |
182 case CFWL_WidgetCapacity::FontSize: { | 175 case CFWL_WidgetCapacity::FontSize: { |
183 if (CXFA_FFWidget* pWidget = | 176 if (CXFA_FFWidget* pWidget = |
184 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { | 177 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { |
185 m_fCapacity = pWidget->GetDataAcc()->GetFontSize(); | 178 m_fCapacity = pWidget->GetDataAcc()->GetFontSize(); |
186 return &m_fCapacity; | 179 return &m_fCapacity; |
187 } | 180 } |
188 } break; | 181 break; |
| 182 } |
189 case CFWL_WidgetCapacity::TextColor: { | 183 case CFWL_WidgetCapacity::TextColor: { |
190 if (CXFA_FFWidget* pWidget = | 184 if (CXFA_FFWidget* pWidget = |
191 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { | 185 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { |
192 m_dwCapacity = pWidget->GetDataAcc()->GetTextColor(); | 186 m_dwCapacity = pWidget->GetDataAcc()->GetTextColor(); |
193 return &m_dwCapacity; | 187 return &m_dwCapacity; |
194 } | 188 } |
195 } break; | 189 break; |
| 190 } |
196 case CFWL_WidgetCapacity::LineHeight: { | 191 case CFWL_WidgetCapacity::LineHeight: { |
197 if (CXFA_FFWidget* pWidget = | 192 if (CXFA_FFWidget* pWidget = |
198 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { | 193 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { |
199 m_fCapacity = pWidget->GetDataAcc()->GetLineHeight(); | 194 m_fCapacity = pWidget->GetDataAcc()->GetLineHeight(); |
200 return &m_fCapacity; | 195 return &m_fCapacity; |
201 } | 196 } |
202 } break; | 197 break; |
| 198 } |
203 case CFWL_WidgetCapacity::ScrollBarWidth: { | 199 case CFWL_WidgetCapacity::ScrollBarWidth: { |
204 m_fCapacity = 9; | 200 m_fCapacity = 9; |
205 return &m_fCapacity; | 201 return &m_fCapacity; |
206 } break; | 202 } |
207 case CFWL_WidgetCapacity::UIMargin: { | 203 case CFWL_WidgetCapacity::UIMargin: { |
208 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); | 204 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); |
209 if (pWidget) { | 205 if (pWidget) { |
210 CXFA_LayoutItem* pItem = pWidget; | 206 CXFA_LayoutItem* pItem = pWidget; |
211 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); | 207 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); |
212 pWidgetAcc->GetUIMargin(m_Rect); | 208 pWidgetAcc->GetUIMargin(m_Rect); |
213 if (CXFA_Para para = pWidgetAcc->GetPara()) { | 209 if (CXFA_Para para = pWidgetAcc->GetPara()) { |
214 m_Rect.left += para.GetMarginLeft(); | 210 m_Rect.left += para.GetMarginLeft(); |
215 if (pWidgetAcc->IsMultiLine()) { | 211 if (pWidgetAcc->IsMultiLine()) { |
216 m_Rect.width += para.GetMarginRight(); | 212 m_Rect.width += para.GetMarginRight(); |
217 } | 213 } |
218 } | 214 } |
219 if (!pItem->GetPrev()) { | 215 if (!pItem->GetPrev()) { |
220 if (pItem->GetNext()) { | 216 if (pItem->GetNext()) { |
221 m_Rect.height = 0; | 217 m_Rect.height = 0; |
222 } | 218 } |
223 } else if (!pItem->GetNext()) { | 219 } else if (!pItem->GetNext()) { |
224 m_Rect.top = 0; | 220 m_Rect.top = 0; |
225 } else { | 221 } else { |
226 m_Rect.top = 0; | 222 m_Rect.top = 0; |
227 m_Rect.height = 0; | 223 m_Rect.height = 0; |
228 } | 224 } |
229 } | 225 } |
230 return &m_Rect; | 226 return &m_Rect; |
231 } break; | 227 } |
232 case CFWL_WidgetCapacity::SpaceAboveBelow: { | 228 case CFWL_WidgetCapacity::SpaceAboveBelow: { |
233 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); | 229 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pThemePart->m_pWidget); |
234 if (pWidget) { | 230 if (pWidget) { |
235 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); | 231 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); |
236 if (CXFA_Para para = pWidgetAcc->GetPara()) { | 232 if (CXFA_Para para = pWidgetAcc->GetPara()) { |
237 m_SizeAboveBelow.x = para.GetSpaceAbove(); | 233 m_SizeAboveBelow.x = para.GetSpaceAbove(); |
238 m_SizeAboveBelow.y = para.GetSpaceBelow(); | 234 m_SizeAboveBelow.y = para.GetSpaceBelow(); |
239 } | 235 } |
240 } | 236 } |
241 return &m_SizeAboveBelow; | 237 return &m_SizeAboveBelow; |
242 } break; | 238 } |
243 default: | 239 default: |
244 break; | 240 break; |
245 } | 241 } |
246 | 242 |
247 int dwCapValue = static_cast<int>(dwCapacity); | 243 int dwCapValue = static_cast<int>(dwCapacity); |
248 if (pThemePart->m_pWidget->GetClassID() == FWL_Type::MonthCalendar && | 244 if (pThemePart->m_pWidget->GetClassID() == FWL_Type::MonthCalendar && |
249 dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) && | 245 dwCapValue >= static_cast<int>(CFWL_WidgetCapacity::Today) && |
250 dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) { | 246 dwCapValue <= static_cast<int>(CFWL_WidgetCapacity::December)) { |
251 if (CXFA_FFWidget* pWidget = | 247 if (CXFA_FFWidget* pWidget = |
252 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { | 248 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 default: | 312 default: |
317 break; | 313 break; |
318 } | 314 } |
319 if (!m_wsResource.IsEmpty()) | 315 if (!m_wsResource.IsEmpty()) |
320 return &m_wsResource; | 316 return &m_wsResource; |
321 } | 317 } |
322 } | 318 } |
323 return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); | 319 return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); |
324 } | 320 } |
325 | 321 |
326 FX_BOOL CXFA_FWLTheme::IsCustomizedLayout(IFWL_Widget* pWidget) { | 322 bool CXFA_FWLTheme::IsCustomizedLayout(IFWL_Widget* pWidget) { |
327 return GetTheme(pWidget)->IsCustomizedLayout(pWidget); | 323 return GetTheme(pWidget)->IsCustomizedLayout(pWidget); |
328 } | 324 } |
329 | 325 |
330 FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { | 326 void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { |
331 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { | 327 if (pParams->m_pWidget->GetClassID() == FWL_Type::MonthCalendar) { |
332 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 328 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
333 if (!pWidget) | 329 if (!pWidget || !pParams || !m_pTextOut) |
334 return FALSE; | 330 return; |
335 if (!pParams) | 331 |
336 return FALSE; | |
337 if (!m_pTextOut) | |
338 return FALSE; | |
339 m_pTextOut->SetFont(m_pCalendarFont); | 332 m_pTextOut->SetFont(m_pCalendarFont); |
340 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); | 333 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); |
341 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); | 334 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); |
342 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 335 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
343 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 336 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
344 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), | 337 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), |
345 pParams->m_wsText.GetLength(), rect); | 338 pParams->m_wsText.GetLength(), rect); |
346 return TRUE; | |
347 } | 339 } |
| 340 |
348 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 341 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
349 if (!pWidget) | 342 if (!pWidget) |
350 return FALSE; | 343 return; |
351 | 344 |
352 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); | 345 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); |
353 m_pTextOut->SetFont(pAcc->GetFDEFont()); | 346 m_pTextOut->SetFont(pAcc->GetFDEFont()); |
354 m_pTextOut->SetFontSize(pAcc->GetFontSize()); | 347 m_pTextOut->SetFontSize(pAcc->GetFontSize()); |
355 m_pTextOut->SetTextColor(pAcc->GetTextColor()); | 348 m_pTextOut->SetTextColor(pAcc->GetTextColor()); |
356 if (!pParams) | 349 if (!pParams) |
357 return FALSE; | 350 return; |
| 351 |
358 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 352 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
359 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 353 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
360 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), | 354 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), |
361 pParams->m_wsText.GetLength(), rect); | 355 pParams->m_wsText.GetLength(), rect); |
362 return TRUE; | |
363 } | 356 } |
364 | 357 |
365 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { | 358 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { |
366 switch (pWidget->GetClassID()) { | 359 switch (pWidget->GetClassID()) { |
367 case FWL_Type::CheckBox: | 360 case FWL_Type::CheckBox: |
368 return m_pCheckBoxTP.get(); | 361 return m_pCheckBoxTP.get(); |
369 case FWL_Type::ListBox: | 362 case FWL_Type::ListBox: |
370 return m_pListBoxTP.get(); | 363 return m_pListBoxTP.get(); |
371 case FWL_Type::PictureBox: | 364 case FWL_Type::PictureBox: |
372 return m_pPictureBoxTP.get(); | 365 return m_pPictureBoxTP.get(); |
(...skipping 10 matching lines...) Expand all Loading... |
383 case FWL_Type::PushButton: | 376 case FWL_Type::PushButton: |
384 return m_pPushButtonTP.get(); | 377 return m_pPushButtonTP.get(); |
385 case FWL_Type::Caret: | 378 case FWL_Type::Caret: |
386 return m_pCaretTP.get(); | 379 return m_pCaretTP.get(); |
387 case FWL_Type::Barcode: | 380 case FWL_Type::Barcode: |
388 return m_pBarcodeTP.get(); | 381 return m_pBarcodeTP.get(); |
389 default: | 382 default: |
390 return nullptr; | 383 return nullptr; |
391 } | 384 } |
392 } | 385 } |
OLD | NEW |