| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); | 154 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); |
| 155 if (!pRenderDevice) | 155 if (!pRenderDevice) |
| 156 return FALSE; | 156 return FALSE; |
| 157 m_pTextOut->SetRenderDevice(pRenderDevice); | 157 m_pTextOut->SetRenderDevice(pRenderDevice); |
| 158 CFX_Matrix mtPart = pParams->m_matrix; | 158 CFX_Matrix mtPart = pParams->m_matrix; |
| 159 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); | 159 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); |
| 160 if (pMatrix) { | 160 if (pMatrix) { |
| 161 mtPart.Concat(*pMatrix); | 161 mtPart.Concat(*pMatrix); |
| 162 } | 162 } |
| 163 m_pTextOut->SetMatrix(mtPart); | 163 m_pTextOut->SetMatrix(mtPart); |
| 164 m_pTextOut->DrawLogicText(pParams->m_wsText, pParams->m_wsText.GetLength(), | 164 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), |
| 165 pParams->m_rtPart); | 165 pParams->m_wsText.GetLength(), pParams->m_rtPart); |
| 166 return TRUE; | 166 return TRUE; |
| 167 } | 167 } |
| 168 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 168 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
| 169 if (!pWidget) { | 169 if (!pWidget) { |
| 170 return FWL_ERR_Indefinite; | 170 return FWL_ERR_Indefinite; |
| 171 } | 171 } |
| 172 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); | 172 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); |
| 173 CFX_Graphics* pGraphics = pParams->m_pGraphics; | 173 CFX_Graphics* pGraphics = pParams->m_pGraphics; |
| 174 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); | 174 CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); |
| 175 if (!pRenderDevice) | 175 if (!pRenderDevice) |
| 176 return FALSE; | 176 return FALSE; |
| 177 m_pTextOut->SetRenderDevice(pRenderDevice); | 177 m_pTextOut->SetRenderDevice(pRenderDevice); |
| 178 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 178 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
| 179 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 179 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 180 m_pTextOut->SetFont(pAcc->GetFDEFont()); | 180 m_pTextOut->SetFont(pAcc->GetFDEFont()); |
| 181 m_pTextOut->SetFontSize(pAcc->GetFontSize()); | 181 m_pTextOut->SetFontSize(pAcc->GetFontSize()); |
| 182 m_pTextOut->SetTextColor(pAcc->GetTextColor()); | 182 m_pTextOut->SetTextColor(pAcc->GetTextColor()); |
| 183 CFX_Matrix mtPart = pParams->m_matrix; | 183 CFX_Matrix mtPart = pParams->m_matrix; |
| 184 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); | 184 CFX_Matrix* pMatrix = pGraphics->GetMatrix(); |
| 185 if (pMatrix) { | 185 if (pMatrix) { |
| 186 mtPart.Concat(*pMatrix); | 186 mtPart.Concat(*pMatrix); |
| 187 } | 187 } |
| 188 m_pTextOut->SetMatrix(mtPart); | 188 m_pTextOut->SetMatrix(mtPart); |
| 189 m_pTextOut->DrawLogicText(pParams->m_wsText, pParams->m_wsText.GetLength(), | 189 m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), |
| 190 pParams->m_rtPart); | 190 pParams->m_wsText.GetLength(), pParams->m_rtPart); |
| 191 return TRUE; | 191 return TRUE; |
| 192 } | 192 } |
| 193 void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, | 193 void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, |
| 194 uint32_t dwCapacity) { | 194 uint32_t dwCapacity) { |
| 195 switch (dwCapacity) { | 195 switch (dwCapacity) { |
| 196 case FWL_WGTCAPACITY_Font: { | 196 case FWL_WGTCAPACITY_Font: { |
| 197 if (CXFA_FFWidget* pWidget = | 197 if (CXFA_FFWidget* pWidget = |
| 198 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { | 198 XFA_ThemeGetOuterWidget(pThemePart->m_pWidget)) { |
| 199 return pWidget->GetDataAcc()->GetFDEFont(); | 199 return pWidget->GetDataAcc()->GetFDEFont(); |
| 200 } | 200 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 if (!pParams) | 300 if (!pParams) |
| 301 return FALSE; | 301 return FALSE; |
| 302 if (!m_pTextOut) | 302 if (!m_pTextOut) |
| 303 return FALSE; | 303 return FALSE; |
| 304 m_pTextOut->SetFont(m_pCalendarFont); | 304 m_pTextOut->SetFont(m_pCalendarFont); |
| 305 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); | 305 m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); |
| 306 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); | 306 m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); |
| 307 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 307 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 308 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 308 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
| 309 m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), | 309 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), |
| 310 rect); | 310 pParams->m_wsText.GetLength(), rect); |
| 311 return TRUE; | 311 return TRUE; |
| 312 } | 312 } |
| 313 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); | 313 CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); |
| 314 if (!pWidget) { | 314 if (!pWidget) { |
| 315 return FWL_ERR_Indefinite; | 315 return FWL_ERR_Indefinite; |
| 316 } | 316 } |
| 317 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); | 317 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); |
| 318 m_pTextOut->SetFont(pAcc->GetFDEFont()); | 318 m_pTextOut->SetFont(pAcc->GetFDEFont()); |
| 319 m_pTextOut->SetFontSize(pAcc->GetFontSize()); | 319 m_pTextOut->SetFontSize(pAcc->GetFontSize()); |
| 320 m_pTextOut->SetTextColor(pAcc->GetTextColor()); | 320 m_pTextOut->SetTextColor(pAcc->GetTextColor()); |
| 321 if (!pParams) | 321 if (!pParams) |
| 322 return FALSE; | 322 return FALSE; |
| 323 if (!m_pTextOut) | 323 if (!m_pTextOut) |
| 324 return FALSE; | 324 return FALSE; |
| 325 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); | 325 m_pTextOut->SetAlignment(pParams->m_iTTOAlign); |
| 326 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); | 326 m_pTextOut->SetStyles(pParams->m_dwTTOStyles); |
| 327 m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), | 327 m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), |
| 328 rect); | 328 pParams->m_wsText.GetLength(), rect); |
| 329 return TRUE; | 329 return TRUE; |
| 330 } | 330 } |
| 331 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { | 331 CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { |
| 332 switch (pWidget->GetClassID()) { | 332 switch (pWidget->GetClassID()) { |
| 333 case FWL_CLASSHASH_CheckBox: | 333 case FWL_CLASSHASH_CheckBox: |
| 334 return m_pCheckBoxTP; | 334 return m_pCheckBoxTP; |
| 335 case FWL_CLASSHASH_ListBox: | 335 case FWL_CLASSHASH_ListBox: |
| 336 return m_pListBoxTP; | 336 return m_pListBoxTP; |
| 337 case FWL_CLASSHASH_PictureBox: | 337 case FWL_CLASSHASH_PictureBox: |
| 338 return m_pPictureBoxTP; | 338 return m_pPictureBoxTP; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 CFX_Color crLine(cr); | 425 CFX_Color crLine(cr); |
| 426 pParams->m_pGraphics->SetStrokeColor(&crLine); | 426 pParams->m_pGraphics->SetStrokeColor(&crLine); |
| 427 pParams->m_pGraphics->SetLineWidth(fWidth); | 427 pParams->m_pGraphics->SetLineWidth(fWidth); |
| 428 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); | 428 pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); |
| 429 return TRUE; | 429 return TRUE; |
| 430 } | 430 } |
| 431 return CFWL_EditTP::DrawBackground(pParams); | 431 return CFWL_EditTP::DrawBackground(pParams); |
| 432 } | 432 } |
| OLD | NEW |