| 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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
| 8 #include "../common/xfa_common.h" | 8 #include "../common/xfa_common.h" |
| 9 #include "xfa_ffConfigAcc.h" | 9 #include "xfa_ffConfigAcc.h" |
| 10 CXFA_FFConfigAcc::CXFA_FFConfigAcc(CXFA_Node *pNode) | 10 CXFA_FFConfigAcc::CXFA_FFConfigAcc(CXFA_Node *pNode) |
| 11 : m_pNode(pNode) | 11 : m_pNode(pNode) |
| 12 , m_pPsMapNode(NULL) | 12 , m_pPsMapNode(NULL) |
| 13 { | 13 { |
| 14 } | 14 } |
| 15 CXFA_FFConfigAcc::~CXFA_FFConfigAcc() | 15 CXFA_FFConfigAcc::~CXFA_FFConfigAcc() |
| 16 { | 16 { |
| 17 } | 17 } |
| 18 FX_INT32 CXFA_FFConfigAcc::CountChildren() | 18 int32_t CXFA_FFConfigAcc::CountChildren() |
| 19 { | 19 { |
| 20 GetPsMapNode(); | 20 GetPsMapNode(); |
| 21 if (m_pPsMapNode == NULL) { | 21 if (m_pPsMapNode == NULL) { |
| 22 return 0; | 22 return 0; |
| 23 } | 23 } |
| 24 FX_INT32 iCount = 0; | 24 int32_t iCount = 0; |
| 25 CXFA_Node* pNode = m_pPsMapNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 25 CXFA_Node* pNode = m_pPsMapNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 26 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 26 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 27 iCount++; | 27 iCount++; |
| 28 } | 28 } |
| 29 return iCount; | 29 return iCount; |
| 30 } | 30 } |
| 31 FX_BOOL CXFA_FFConfigAcc::GetFontInfo(FX_INT32 index, CFX_WideString &wsFontFami
ly, CFX_WideString &wsPsName, FX_BOOL bBold, FX_BOOL bItalic) | 31 FX_BOOL CXFA_FFConfigAcc::GetFontInfo(int32_t index, CFX_WideString &wsFontFamil
y, CFX_WideString &wsPsName, FX_BOOL bBold, FX_BOOL bItalic) |
| 32 { | 32 { |
| 33 if (index < 0 || index >= CountChildren()) { | 33 if (index < 0 || index >= CountChildren()) { |
| 34 return FALSE; | 34 return FALSE; |
| 35 } | 35 } |
| 36 CXFA_Node *pFontNode = m_pPsMapNode->GetChild(index, XFA_ELEMENT_Font); | 36 CXFA_Node *pFontNode = m_pPsMapNode->GetChild(index, XFA_ELEMENT_Font); |
| 37 if (pFontNode == NULL) { | 37 if (pFontNode == NULL) { |
| 38 return FALSE; | 38 return FALSE; |
| 39 } | 39 } |
| 40 wsFontFamily.Empty(); | 40 wsFontFamily.Empty(); |
| 41 wsPsName.Empty(); | 41 wsPsName.Empty(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 } | 56 } |
| 57 return wsFontFamily.GetLength() > 0; | 57 return wsFontFamily.GetLength() > 0; |
| 58 } | 58 } |
| 59 void CXFA_FFConfigAcc::GetPsMapNode() | 59 void CXFA_FFConfigAcc::GetPsMapNode() |
| 60 { | 60 { |
| 61 if (m_pNode == NULL) { | 61 if (m_pNode == NULL) { |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 m_pPsMapNode = m_pNode->GetChild(0, XFA_ELEMENT_PsMap); | 64 m_pPsMapNode = m_pNode->GetChild(0, XFA_ELEMENT_PsMap); |
| 65 } | 65 } |
| OLD | NEW |