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_ffwidgetacc.h" | 7 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 if (pData->m_pDIBitmap && !pData->m_bNamedImage) | 1491 if (pData->m_pDIBitmap && !pData->m_bNamedImage) |
1492 delete pData->m_pDIBitmap; | 1492 delete pData->m_pDIBitmap; |
1493 | 1493 |
1494 pData->m_pDIBitmap = newImage; | 1494 pData->m_pDIBitmap = newImage; |
1495 } | 1495 } |
1496 | 1496 |
1497 CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() { | 1497 CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() { |
1498 return m_pLayoutData.get(); | 1498 return m_pLayoutData.get(); |
1499 } | 1499 } |
1500 | 1500 |
1501 CFGAS_GEFont* CXFA_WidgetAcc::GetFDEFont() { | 1501 CFX_RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() { |
1502 CFX_WideStringC wsFontName = FX_WSTRC(L"Courier"); | 1502 CFX_WideStringC wsFontName = FX_WSTRC(L"Courier"); |
1503 uint32_t dwFontStyle = 0; | 1503 uint32_t dwFontStyle = 0; |
1504 if (CXFA_Font font = GetFont()) { | 1504 if (CXFA_Font font = GetFont()) { |
1505 if (font.IsBold()) { | 1505 if (font.IsBold()) |
1506 dwFontStyle |= FX_FONTSTYLE_Bold; | 1506 dwFontStyle |= FX_FONTSTYLE_Bold; |
1507 } | 1507 if (font.IsItalic()) |
1508 if (font.IsItalic()) { | |
1509 dwFontStyle |= FX_FONTSTYLE_Italic; | 1508 dwFontStyle |= FX_FONTSTYLE_Italic; |
1510 } | |
1511 font.GetTypeface(wsFontName); | 1509 font.GetTypeface(wsFontName); |
1512 } | 1510 } |
1513 CXFA_FFDoc* pDoc = GetDoc(); | 1511 |
| 1512 auto pDoc = GetDoc(); |
1514 return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName, | 1513 return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName, |
1515 dwFontStyle); | 1514 dwFontStyle); |
1516 } | 1515 } |
1517 FX_FLOAT CXFA_WidgetAcc::GetFontSize() { | 1516 FX_FLOAT CXFA_WidgetAcc::GetFontSize() { |
1518 FX_FLOAT fFontSize = 10.0f; | 1517 FX_FLOAT fFontSize = 10.0f; |
1519 if (CXFA_Font font = GetFont()) { | 1518 if (CXFA_Font font = GetFont()) { |
1520 fFontSize = font.GetFontSize(); | 1519 fFontSize = font.GetFontSize(); |
1521 } | 1520 } |
1522 return fFontSize < 0.1f ? 10.0f : fFontSize; | 1521 return fFontSize < 0.1f ? 10.0f : fFontSize; |
1523 } | 1522 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 if (pIDNode) { | 1670 if (pIDNode) { |
1672 pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData()); | 1671 pEmbAcc = static_cast<CXFA_WidgetAcc*>(pIDNode->GetWidgetData()); |
1673 } | 1672 } |
1674 if (pEmbAcc) { | 1673 if (pEmbAcc) { |
1675 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); | 1674 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); |
1676 return true; | 1675 return true; |
1677 } | 1676 } |
1678 } | 1677 } |
1679 return false; | 1678 return false; |
1680 } | 1679 } |
OLD | NEW |