diff options
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r-- | core/src/fpdfdoc/doc_action.cpp | 31 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_formcontrol.cpp | 21 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_utils.cpp | 47 |
3 files changed, 25 insertions, 74 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index e68a8c8a06..28d17cd673 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -257,37 +257,6 @@ CPDF_Action CPDF_AAction::GetAction(AActionType eType) const { } return CPDF_Action(m_pDict->GetDict(g_sAATypes[(int)eType])); } -FX_POSITION CPDF_AAction::GetStartPos() const { - if (!m_pDict) { - return NULL; - } - return m_pDict->GetStartPos(); -} -CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos, - AActionType& eType) const { - if (!m_pDict) { - return CPDF_Action(); - } - CFX_ByteString csKey; - CPDF_Object* pObj = m_pDict->GetNextElement(pos, csKey); - if (!pObj) { - return CPDF_Action(); - } - CPDF_Object* pDirect = pObj->GetDirect(); - CPDF_Dictionary* pDict = ToDictionary(pDirect); - if (!pDict) - return CPDF_Action(); - - int i = 0; - while (g_sAATypes[i][0] != '\0') { - if (csKey == g_sAATypes[i]) { - break; - } - i++; - } - eType = (AActionType)i; - return CPDF_Action(pDict); -} CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {} diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp index 93e837feaf..bd339e375c 100644 --- a/core/src/fpdfdoc/doc_formcontrol.cpp +++ b/core/src/fpdfdoc/doc_formcontrol.cpp @@ -27,11 +27,9 @@ CFX_ByteString CPDF_FormControl::GetOnStateName() { if (!pN) { return csOn; } - FX_POSITION pos = pN->GetStartPos(); - while (pos) { - pN->GetNextElement(pos, csOn); - if (csOn != "Off") { - return csOn; + for (const auto& it : *pN) { + if (it.first != "Off") { + return it.first; } } return CFX_ByteString(); @@ -54,10 +52,8 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) { if (!pAP) { return; } - FX_POSITION pos1 = pAP->GetStartPos(); - while (pos1) { - CFX_ByteString csKey1; - CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1); + for (const auto& it : *pAP) { + CPDF_Object* pObj1 = it.second; if (!pObj1) { continue; } @@ -66,10 +62,9 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) { if (!pSubDict) continue; - FX_POSITION pos2 = pSubDict->GetStartPos(); - while (pos2) { - CFX_ByteString csKey2; - CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2); + for (const auto& subdict_it : *pSubDict) { + const CFX_ByteString& csKey2 = subdict_it.first; + CPDF_Object* pObj2 = subdict_it.second; if (!pObj2) { continue; } diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index 01a7470ef0..89836739b3 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -279,11 +279,8 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { return 0; } FX_DWORD dwCount = 0; - FX_POSITION pos = pFonts->GetStartPos(); - while (pos) { - CPDF_Object* pObj = NULL; - CFX_ByteString csKey; - pObj = pFonts->GetNextElement(pos, csKey); + for (const auto& it : *pFonts) { + CPDF_Object* pObj = it.second; if (!pObj) { continue; } @@ -311,11 +308,9 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, return NULL; } FX_DWORD dwCount = 0; - FX_POSITION pos = pFonts->GetStartPos(); - while (pos) { - CPDF_Object* pObj = NULL; - CFX_ByteString csKey; - pObj = pFonts->GetNextElement(pos, csKey); + for (const auto& it : *pFonts) { + const CFX_ByteString& csKey = it.first; + CPDF_Object* pObj = it.second; if (!pObj) { continue; } @@ -371,11 +366,9 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFonts) { return NULL; } - FX_POSITION pos = pFonts->GetStartPos(); - while (pos) { - CPDF_Object* pObj = NULL; - CFX_ByteString csKey; - pObj = pFonts->GetNextElement(pos, csKey); + for (const auto& it : *pFonts) { + const CFX_ByteString& csKey = it.first; + CPDF_Object* pObj = it.second; if (!pObj) { continue; } @@ -414,11 +407,9 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, if (!pFonts) { return NULL; } - FX_POSITION pos = pFonts->GetStartPos(); - while (pos) { - CPDF_Object* pObj = NULL; - CFX_ByteString csKey; - pObj = pFonts->GetNextElement(pos, csKey); + for (const auto& it : *pFonts) { + const CFX_ByteString& csKey = it.first; + CPDF_Object* pObj = it.second; if (!pObj) { continue; } @@ -472,11 +463,9 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, if (!pFonts) { return FALSE; } - FX_POSITION pos = pFonts->GetStartPos(); - while (pos) { - CPDF_Object* pObj = NULL; - CFX_ByteString csKey; - pObj = pFonts->GetNextElement(pos, csKey); + for (const auto& it : *pFonts) { + const CFX_ByteString& csKey = it.first; + CPDF_Object* pObj = it.second; if (!pObj) { continue; } @@ -512,11 +501,9 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, if (csFontName.GetLength() > 0) { csFontName.Remove(' '); } - FX_POSITION pos = pFonts->GetStartPos(); - while (pos) { - CPDF_Object* pObj = NULL; - CFX_ByteString csKey, csTmp; - pObj = pFonts->GetNextElement(pos, csKey); + for (const auto& it : *pFonts) { + const CFX_ByteString& csKey = it.first; + CPDF_Object* pObj = it.second; if (!pObj) { continue; } |