diff options
author | Wei Li <weili@chromium.org> | 2016-01-28 15:59:38 -0800 |
---|---|---|
committer | Wei Li <weili@chromium.org> | 2016-01-28 15:59:38 -0800 |
commit | d45e7a51904164fb22049f0a7a80d2a94c06936b (patch) | |
tree | 047012090dd6dac5ed99c620f250baea480059dd /core/src/fpdfdoc | |
parent | badb41230bae96cba8fc481de47592836e3f43f8 (diff) | |
download | pdfium-d45e7a51904164fb22049f0a7a80d2a94c06936b.tar.xz |
Member function name refactoring
This is needed by Cl 1634373003 as the name collision with virtual functions
will be shown as warnings on Linux. Also, it is better to use
different names for different cases.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1644633003 .
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r-- | core/src/fpdfdoc/doc_action.cpp | 46 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_annot.cpp | 59 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_ap.cpp | 93 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_basic.cpp | 64 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_bookmark.cpp | 20 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_form.cpp | 72 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_formcontrol.cpp | 99 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_formfield.cpp | 21 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_link.cpp | 10 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_metadata.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_ocg.cpp | 52 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_tagged.cpp | 48 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_utils.cpp | 76 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_viewerPreferences.cpp | 20 |
14 files changed, 343 insertions, 339 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index 28d17cd673..97ca046bb9 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -10,7 +10,7 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { if (!m_pDict) { return CPDF_Dest(); } - CFX_ByteString type = m_pDict->GetString("S"); + CFX_ByteString type = m_pDict->GetStringBy("S"); if (type != "GoTo" && type != "GoToR") { return CPDF_Dest(); } @@ -35,7 +35,7 @@ const FX_CHAR* g_sATypes[] = { CPDF_Action::ActionType CPDF_Action::GetType() const { ActionType eType = Unknown; if (m_pDict) { - CFX_ByteString csType = m_pDict->GetString("S"); + CFX_ByteString csType = m_pDict->GetStringBy("S"); if (!csType.IsEmpty()) { int i = 0; while (g_sATypes[i][0] != '\0') { @@ -49,7 +49,7 @@ CPDF_Action::ActionType CPDF_Action::GetType() const { return eType; } CFX_WideString CPDF_Action::GetFilePath() const { - CFX_ByteString type = m_pDict->GetString("S"); + CFX_ByteString type = m_pDict->GetStringBy("S"); if (type != "GoToR" && type != "Launch" && type != "SubmitForm" && type != "ImportData") { return CFX_WideString(); @@ -58,9 +58,9 @@ CFX_WideString CPDF_Action::GetFilePath() const { CFX_WideString path; if (!pFile) { if (type == "Launch") { - CPDF_Dictionary* pWinDict = m_pDict->GetDict("Win"); + CPDF_Dictionary* pWinDict = m_pDict->GetDictBy("Win"); if (pWinDict) { - return CFX_WideString::FromLocal(pWinDict->GetString("F")); + return CFX_WideString::FromLocal(pWinDict->GetStringBy("F")); } } return path; @@ -74,15 +74,15 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const { if (!m_pDict) { return csURI; } - if (m_pDict->GetString("S") != "URI") { + if (m_pDict->GetStringBy("S") != "URI") { return csURI; } - csURI = m_pDict->GetString("URI"); + csURI = m_pDict->GetStringBy("URI"); CPDF_Dictionary* pRoot = pDoc->GetRoot(); - CPDF_Dictionary* pURI = pRoot->GetDict("URI"); + CPDF_Dictionary* pURI = pRoot->GetDictBy("URI"); if (pURI) { if (csURI.Find(":", 0) < 1) { - csURI = pURI->GetString("Base") + csURI; + csURI = pURI->GetStringBy("Base") + csURI; } } return csURI; @@ -95,12 +95,12 @@ FX_DWORD CPDF_ActionFields::GetFieldsCount() const { if (!pDict) { return 0; } - CFX_ByteString csType = pDict->GetString("S"); + CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields = NULL; if (csType == "Hide") { pFields = pDict->GetElementValue("T"); } else { - pFields = pDict->GetArray("Fields"); + pFields = pDict->GetArrayBy("Fields"); } if (!pFields) return 0; @@ -122,12 +122,12 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const { if (!pDict) return fields; - CFX_ByteString csType = pDict->GetString("S"); + CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields; if (csType == "Hide") pFields = pDict->GetElementValue("T"); else - pFields = pDict->GetArray("Fields"); + pFields = pDict->GetArrayBy("Fields"); if (!pFields) return fields; @@ -153,12 +153,12 @@ CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const { if (!pDict) { return NULL; } - CFX_ByteString csType = pDict->GetString("S"); + CFX_ByteString csType = pDict->GetStringBy("S"); CPDF_Object* pFields = NULL; if (csType == "Hide") { pFields = pDict->GetElementValue("T"); } else { - pFields = pDict->GetArray("Fields"); + pFields = pDict->GetArrayBy("Fields"); } if (!pFields) { return NULL; @@ -185,12 +185,12 @@ CPDF_Dictionary* CPDF_Action::GetAnnot() const { if (!m_pDict) { return nullptr; } - CFX_ByteString csType = m_pDict->GetString("S"); + CFX_ByteString csType = m_pDict->GetStringBy("S"); if (csType == "Rendition") { - return m_pDict->GetDict("AN"); + return m_pDict->GetDictBy("AN"); } if (csType == "Movie") { - return m_pDict->GetDict("Annotation"); + return m_pDict->GetDictBy("Annotation"); } return nullptr; } @@ -198,12 +198,12 @@ int32_t CPDF_Action::GetOperationType() const { if (!m_pDict) { return 0; } - CFX_ByteString csType = m_pDict->GetString("S"); + CFX_ByteString csType = m_pDict->GetStringBy("S"); if (csType == "Rendition") { - return m_pDict->GetInteger("OP"); + return m_pDict->GetIntegerBy("OP"); } if (csType == "Movie") { - CFX_ByteString csOP = m_pDict->GetString("Operation"); + CFX_ByteString csOP = m_pDict->GetStringBy("Operation"); if (csOP == "Play") { return 0; } @@ -241,7 +241,7 @@ CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const { if (iIndex == 0) return CPDF_Action(pDict); } else if (CPDF_Array* pArray = ToArray(pNext)) { - return CPDF_Action(pArray->GetDict(iIndex)); + return CPDF_Action(pArray->GetDictAt(iIndex)); } return CPDF_Action(); } @@ -255,7 +255,7 @@ CPDF_Action CPDF_AAction::GetAction(AActionType eType) const { if (!m_pDict) { return CPDF_Action(); } - return CPDF_Action(m_pDict->GetDict(g_sAATypes[(int)eType])); + return CPDF_Action(m_pDict->GetDictBy(g_sAATypes[(int)eType])); } CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {} diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index 5786349490..a73d24410c 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -12,13 +12,14 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) if (!pPage->m_pFormDict) return; - CPDF_Array* pAnnots = pPage->m_pFormDict->GetArray("Annots"); + CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots"); if (!pAnnots) return; CPDF_Dictionary* pRoot = m_pDocument->GetRoot(); - CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm"); - FX_BOOL bRegenerateAP = pAcroForm && pAcroForm->GetBoolean("NeedAppearances"); + CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); + FX_BOOL bRegenerateAP = + pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances"); for (FX_DWORD i = 0; i < pAnnots->GetCount(); ++i) { CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetElementValue(i)); if (!pDict) @@ -30,10 +31,10 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum); pAnnots->InsertAt(i, pAction); pAnnots->RemoveAt(i + 1); - pDict = pAnnots->GetDict(i); + pDict = pAnnots->GetDictAt(i); } m_AnnotList.push_back(new CPDF_Annot(pDict, this)); - if (bRegenerateAP && pDict->GetConstString("Subtype") == "Widget" && + if (bRegenerateAP && pDict->GetConstStringBy("Subtype") == "Widget" && CPDF_InterForm::UpdatingAPEnabled()) { FPDF_GenerateAP(m_pDocument, pDict); } @@ -72,7 +73,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, IPDF_OCContext* pOCContext = pOptions->m_pOCContext; CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict(); if (pOCContext && pAnnotDict && - !pOCContext->CheckOCGVisible(pAnnotDict->GetDict("OC"))) { + !pOCContext->CheckOCGVisible(pAnnotDict->GetDictBy("OC"))) { continue; } } @@ -117,7 +118,7 @@ void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage, CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList) : m_pAnnotDict(pDict), m_pList(pList), - m_sSubtype(m_pAnnotDict->GetConstString("Subtype")) {} + m_sSubtype(m_pAnnotDict->GetConstStringBy("Subtype")) {} CPDF_Annot::~CPDF_Annot() { ClearCachedAP(); } @@ -135,17 +136,17 @@ void CPDF_Annot::GetRect(CPDF_Rect& rect) const { if (!m_pAnnotDict) { return; } - rect = m_pAnnotDict->GetRect("Rect"); + rect = m_pAnnotDict->GetRectBy("Rect"); rect.Normalize(); } FX_DWORD CPDF_Annot::GetFlags() const { - return m_pAnnotDict->GetInteger("F"); + return m_pAnnotDict->GetIntegerBy("F"); } CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, CPDF_Annot::AppearanceMode mode) { - CPDF_Dictionary* pAP = pAnnotDict->GetDict("AP"); + CPDF_Dictionary* pAP = pAnnotDict->GetDictBy("AP"); if (!pAP) { return NULL; } @@ -164,19 +165,19 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, return pStream; if (CPDF_Dictionary* pDict = psub->AsDictionary()) { - CFX_ByteString as = pAnnotDict->GetString("AS"); + CFX_ByteString as = pAnnotDict->GetStringBy("AS"); if (as.IsEmpty()) { - CFX_ByteString value = pAnnotDict->GetString("V"); + CFX_ByteString value = pAnnotDict->GetStringBy("V"); if (value.IsEmpty()) { - CPDF_Dictionary* pDict = pAnnotDict->GetDict("Parent"); - value = pDict ? pDict->GetString("V") : CFX_ByteString(); + CPDF_Dictionary* pDict = pAnnotDict->GetDictBy("Parent"); + value = pDict ? pDict->GetStringBy("V") : CFX_ByteString(); } if (value.IsEmpty() || !pDict->KeyExist(value)) as = "Off"; else as = value; } - return pDict->GetStream(as); + return pDict->GetStreamBy(as); } return nullptr; } @@ -206,8 +207,8 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, if (!pForm) { return NULL; } - CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRect("BBox"); - CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix("Matrix"); + CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox"); + CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix"); form_matrix.TransformRect(form_bbox); CPDF_Rect arect; pAnnot->GetRect(arect); @@ -262,17 +263,17 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) { return; } - CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS"); + CPDF_Dictionary* pBS = m_pAnnotDict->GetDictBy("BS"); char style_char; FX_FLOAT width; CPDF_Array* pDashArray = NULL; if (!pBS) { - CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border"); + CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayBy("Border"); style_char = 'S'; if (pBorderArray) { - width = pBorderArray->GetNumber(2); + width = pBorderArray->GetNumberAt(2); if (pBorderArray->GetCount() == 4) { - pDashArray = pBorderArray->GetArray(3); + pDashArray = pBorderArray->GetArrayAt(3); if (!pDashArray) { return; } @@ -293,20 +294,20 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, width = 1; } } else { - CFX_ByteString style = pBS->GetString("S"); - pDashArray = pBS->GetArray("D"); + CFX_ByteString style = pBS->GetStringBy("S"); + pDashArray = pBS->GetArrayBy("D"); style_char = style[1]; - width = pBS->GetNumber("W"); + width = pBS->GetNumberBy("W"); } if (width <= 0) { return; } - CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); + CPDF_Array* pColor = m_pAnnotDict->GetArrayBy("C"); FX_DWORD argb = 0xff000000; if (pColor) { - int R = (int32_t)(pColor->GetNumber(0) * 255); - int G = (int32_t)(pColor->GetNumber(1) * 255); - int B = (int32_t)(pColor->GetNumber(2) * 255); + int R = (int32_t)(pColor->GetNumberAt(0) * 255); + int G = (int32_t)(pColor->GetNumberAt(1) * 255); + int B = (int32_t)(pColor->GetNumberAt(2) * 255); argb = ArgbEncode(0xff, R, G, B); } CPDF_GraphStateData graph_state; @@ -321,7 +322,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, graph_state.m_DashCount = dash_count; FX_DWORD i; for (i = 0; i < pDashArray->GetCount(); ++i) { - graph_state.m_DashArray[i] = pDashArray->GetNumber(i); + graph_state.m_DashArray[i] = pDashArray->GetNumberAt(i); } if (i < dash_count) { graph_state.m_DashArray[i] = graph_state.m_DashArray[i - 1]; diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index 15576965b1..c84a36d499 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -17,7 +17,7 @@ #define PBS_UNDERLINED 4 FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { - if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != "Widget") { + if (!pAnnotDict || pAnnotDict->GetConstStringBy("Subtype") != "Widget") { return FALSE; } CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString(); @@ -35,9 +35,9 @@ FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { if (field_type == "Btn") { if (!(flags & (1 << 16))) { if (!pAnnotDict->KeyExist("AS")) { - if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDict("Parent")) { + if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDictBy("Parent")) { if (pParentDict->KeyExist("AS")) { - pAnnotDict->SetAtString("AS", pParentDict->GetString("AS")); + pAnnotDict->SetAtString("AS", pParentDict->GetStringBy("AS")); } } } @@ -89,10 +89,10 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc, CFX_ByteString& sSysFontAlias) { if (pDoc && pResDict) { CFX_ByteString sFontAlias; - CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDict("AcroForm"); + CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictBy("AcroForm"); if (CPDF_Font* pPDFFont = AddNativeInterFormFont(pFormDict, pDoc, sSysFontAlias)) { - if (CPDF_Dictionary* pFontList = pResDict->GetDict("Font")) { + if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) { if (!pFontList->KeyExist(sSysFontAlias)) { pFontList->SetAtReference(sSysFontAlias, pDoc, pPDFFont->GetFontDict()); @@ -253,15 +253,16 @@ static CPVT_Color ParseColor(const CPDF_Array& array) { CPVT_Color rt; switch (array.GetCount()) { case 1: - rt = CPVT_Color(CPVT_Color::kGray, array.GetFloat(0)); + rt = CPVT_Color(CPVT_Color::kGray, array.GetFloatAt(0)); break; case 3: - rt = CPVT_Color(CPVT_Color::kRGB, array.GetFloat(0), array.GetFloat(1), - array.GetFloat(2)); + rt = CPVT_Color(CPVT_Color::kRGB, array.GetFloatAt(0), + array.GetFloatAt(1), array.GetFloatAt(2)); break; case 4: - rt = CPVT_Color(CPVT_Color::kCMYK, array.GetFloat(0), array.GetFloat(1), - array.GetFloat(2), array.GetFloat(3)); + rt = CPVT_Color(CPVT_Color::kCMYK, array.GetFloatAt(0), + array.GetFloatAt(1), array.GetFloatAt(2), + array.GetFloatAt(3)); break; } return rt; @@ -271,7 +272,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, const int32_t& nWidgetType) { CPDF_Dictionary* pFormDict = NULL; if (CPDF_Dictionary* pRootDict = pDoc->GetRoot()) { - pFormDict = pRootDict->GetDict("AcroForm"); + pFormDict = pRootDict->GetDictBy("AcroForm"); } if (!pFormDict) { return FALSE; @@ -281,7 +282,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, DA = pDAObj->GetString(); } if (DA.IsEmpty()) { - DA = pFormDict->GetString("DA"); + DA = pFormDict->GetStringBy("DA"); } if (DA.IsEmpty()) { return FALSE; @@ -297,19 +298,19 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPVT_Color crText = ParseColor(DA); FX_BOOL bUseFormRes = FALSE; CPDF_Dictionary* pFontDict = NULL; - CPDF_Dictionary* pDRDict = pAnnotDict->GetDict("DR"); + CPDF_Dictionary* pDRDict = pAnnotDict->GetDictBy("DR"); if (!pDRDict) { - pDRDict = pFormDict->GetDict("DR"); + pDRDict = pFormDict->GetDictBy("DR"); bUseFormRes = TRUE; } CPDF_Dictionary* pDRFontDict = NULL; - if (pDRDict && (pDRFontDict = pDRDict->GetDict("Font"))) { - pFontDict = pDRFontDict->GetDict(sFontName.Mid(1)); + if (pDRDict && (pDRFontDict = pDRDict->GetDictBy("Font"))) { + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1)); if (!pFontDict && !bUseFormRes) { - pDRDict = pFormDict->GetDict("DR"); - pDRFontDict = pDRDict->GetDict("Font"); + pDRDict = pFormDict->GetDictBy("DR"); + pDRFontDict = pDRDict->GetDictBy("Font"); if (pDRFontDict) { - pFontDict = pDRFontDict->GetDict(sFontName.Mid(1)); + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1)); } } } @@ -329,10 +330,10 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (!pDefFont) { return FALSE; } - CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect"); + CPDF_Rect rcAnnot = pAnnotDict->GetRectBy("Rect"); int32_t nRotate = 0; - if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDict("MK")) { - nRotate = pMKDict->GetInteger("R"); + if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK")) { + nRotate = pMKDict->GetIntegerBy("R"); } CPDF_Rect rcBBox; CFX_Matrix matrix; @@ -362,15 +363,15 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, FX_FLOAT fBorderWidth = 1; CPVT_Dash dsBorder(3, 0, 0); CPVT_Color crLeftTop, crRightBottom; - if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDict("BS")) { + if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDictBy("BS")) { if (pBSDict->KeyExist("W")) { - fBorderWidth = pBSDict->GetNumber("W"); + fBorderWidth = pBSDict->GetNumberBy("W"); } - if (CPDF_Array* pArray = pBSDict->GetArray("D")) { - dsBorder = CPVT_Dash(pArray->GetInteger(0), pArray->GetInteger(1), - pArray->GetInteger(2)); + if (CPDF_Array* pArray = pBSDict->GetArrayBy("D")) { + dsBorder = CPVT_Dash(pArray->GetIntegerAt(0), pArray->GetIntegerAt(1), + pArray->GetIntegerAt(2)); } - switch (pBSDict->GetString("S").GetAt(0)) { + switch (pBSDict->GetStringBy("S").GetAt(0)) { case 'S': nBorderStyle = PBS_SOLID; break; @@ -395,11 +396,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } } CPVT_Color crBorder, crBG; - if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDict("MK")) { - if (CPDF_Array* pArray = pMKDict->GetArray("BC")) { + if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK")) { + if (CPDF_Array* pArray = pMKDict->GetArrayBy("BC")) { crBorder = ParseColor(*pArray); } - if (CPDF_Array* pArray = pMKDict->GetArray("BG")) { + if (CPDF_Array* pArray = pMKDict->GetArrayBy("BG")) { crBG = ParseColor(*pArray); } } @@ -420,24 +421,24 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Rect(rcBBox.left + fBorderWidth, rcBBox.bottom + fBorderWidth, rcBBox.right - fBorderWidth, rcBBox.top - fBorderWidth); rcBody.Normalize(); - CPDF_Dictionary* pAPDict = pAnnotDict->GetDict("AP"); + CPDF_Dictionary* pAPDict = pAnnotDict->GetDictBy("AP"); if (!pAPDict) { pAPDict = new CPDF_Dictionary; pAnnotDict->SetAt("AP", pAPDict); } - CPDF_Stream* pNormalStream = pAPDict->GetStream("N"); + CPDF_Stream* pNormalStream = pAPDict->GetStreamBy("N"); if (!pNormalStream) { pNormalStream = new CPDF_Stream(nullptr, 0, nullptr); int32_t objnum = pDoc->AddIndirectObject(pNormalStream); - pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum); + pAnnotDict->GetDictBy("AP")->SetAtReference("N", pDoc, objnum); } CPDF_Dictionary* pStreamDict = pNormalStream->GetDict(); if (pStreamDict) { pStreamDict->SetAtMatrix("Matrix", matrix); pStreamDict->SetAtRect("BBox", rcBBox); - CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); + CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); if (pStreamResList) { - CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); + CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font"); if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); @@ -446,8 +447,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict); } } else { - pStreamDict->SetAt("Resources", pFormDict->GetDict("DR")->Clone()); - pStreamResList = pStreamDict->GetDict("Resources"); + pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); + pStreamResList = pStreamDict->GetDictBy("Resources"); } } switch (nWidgetType) { @@ -467,7 +468,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, ? FPDF_GetFieldAttr(pAnnotDict, "MaxLen")->GetInteger() : 0; CPVT_FontMap map(pDoc, - pStreamDict ? pStreamDict->GetDict("Resources") : NULL, + pStreamDict ? pStreamDict->GetDictBy("Resources") : NULL, pDefFont, sFontName.Right(sFontName.GetLength() - 1)); CPVT_Provider prd(&map); CPDF_VariableText vt; @@ -526,7 +527,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, ? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText() : CFX_WideString(); CPVT_FontMap map(pDoc, - pStreamDict ? pStreamDict->GetDict("Resources") : NULL, + pStreamDict ? pStreamDict->GetDictBy("Resources") : NULL, pDefFont, sFontName.Right(sFontName.GetLength() - 1)); CPVT_Provider prd(&map); CPDF_VariableText vt; @@ -593,7 +594,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, } break; case 2: { CPVT_FontMap map(pDoc, - pStreamDict ? pStreamDict->GetDict("Resources") : NULL, + pStreamDict ? pStreamDict->GetDictBy("Resources") : NULL, pDefFont, sFontName.Right(sFontName.GetLength() - 1)); CPVT_Provider prd(&map); CPDF_Array* pOpts = FPDF_GetFieldAttr(pAnnotDict, "Opt") @@ -622,7 +623,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, FX_BOOL bSelected = FALSE; if (pSels) { for (FX_DWORD s = 0, ssz = pSels->GetCount(); s < ssz; s++) { - if (i == pSels->GetInteger(s)) { + if (i == pSels->GetIntegerAt(s)) { bSelected = TRUE; break; } @@ -683,9 +684,9 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (pStreamDict) { pStreamDict->SetAtMatrix("Matrix", matrix); pStreamDict->SetAtRect("BBox", rcBBox); - CPDF_Dictionary* pStreamResList = pStreamDict->GetDict("Resources"); + CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); if (pStreamResList) { - CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); + CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font"); if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); @@ -694,8 +695,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict); } } else { - pStreamDict->SetAt("Resources", pFormDict->GetDict("DR")->Clone()); - pStreamResList = pStreamDict->GetDict("Resources"); + pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); + pStreamResList = pStreamDict->GetDictBy("Resources"); } } } diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index 3fb997878b..85a6c0f7c8 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -56,15 +56,15 @@ int CPDF_Dest::GetZoomMode() { } FX_FLOAT CPDF_Dest::GetParam(int index) { CPDF_Array* pArray = ToArray(m_pObj); - return pArray ? pArray->GetNumber(2 + index) : 0; + return pArray ? pArray->GetNumberAt(2 + index) : 0; } CFX_ByteString CPDF_Dest::GetRemoteName() { return m_pObj ? m_pObj->GetString() : CFX_ByteString(); } CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& category) { - if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict("Names")) - m_pRoot = pDoc->GetRoot()->GetDict("Names")->GetDict(category); + if (pDoc->GetRoot() && pDoc->GetRoot()->GetDictBy("Names")) + m_pRoot = pDoc->GetRoot()->GetDictBy("Names")->GetDictBy(category); else m_pRoot = NULL; } @@ -76,10 +76,10 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (nLevel > nMaxRecursion) { return NULL; } - CPDF_Array* pLimits = pNode->GetArray("Limits"); + CPDF_Array* pLimits = pNode->GetArrayBy("Limits"); if (pLimits) { - CFX_ByteString csLeft = pLimits->GetString(0); - CFX_ByteString csRight = pLimits->GetString(1); + CFX_ByteString csLeft = pLimits->GetStringAt(0); + CFX_ByteString csRight = pLimits->GetStringAt(1); if (csLeft.Compare(csRight) > 0) { CFX_ByteString csTmp = csRight; csRight = csLeft; @@ -89,11 +89,11 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, return NULL; } } - CPDF_Array* pNames = pNode->GetArray("Names"); + CPDF_Array* pNames = pNode->GetArrayBy("Names"); if (pNames) { FX_DWORD dwCount = pNames->GetCount() / 2; for (FX_DWORD i = 0; i < dwCount; i++) { - CFX_ByteString csValue = pNames->GetString(i * 2); + CFX_ByteString csValue = pNames->GetStringAt(i * 2); int32_t iCompare = csValue.Compare(csName); if (iCompare <= 0) { if (ppFind) { @@ -111,12 +111,12 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, nIndex += dwCount; return NULL; } - CPDF_Array* pKids = pNode->GetArray("Kids"); + CPDF_Array* pKids = pNode->GetArrayBy("Kids"); if (!pKids) { return NULL; } for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } @@ -137,7 +137,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (nLevel > nMaxRecursion) { return NULL; } - CPDF_Array* pNames = pNode->GetArray("Names"); + CPDF_Array* pNames = pNode->GetArrayBy("Names"); if (pNames) { int nCount = pNames->GetCount() / 2; if (nIndex >= nCurIndex + nCount) { @@ -147,15 +147,15 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (ppFind) { *ppFind = pNames; } - csName = pNames->GetString((nIndex - nCurIndex) * 2); + csName = pNames->GetStringAt((nIndex - nCurIndex) * 2); return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); } - CPDF_Array* pKids = pNode->GetArray("Kids"); + CPDF_Array* pKids = pNode->GetArrayBy("Kids"); if (!pKids) { return NULL; } for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } @@ -171,17 +171,17 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) { if (nLevel > nMaxRecursion) { return 0; } - CPDF_Array* pNames = pNode->GetArray("Names"); + CPDF_Array* pNames = pNode->GetArrayBy("Names"); if (pNames) { return pNames->GetCount() / 2; } - CPDF_Array* pKids = pNode->GetArray("Kids"); + CPDF_Array* pKids = pNode->GetArrayBy("Kids"); if (!pKids) { return 0; } int nCount = 0; for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } @@ -224,7 +224,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, const CFX_ByteStringC& sName) { CPDF_Object* pValue = LookupValue(sName); if (!pValue) { - CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict("Dests"); + CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictBy("Dests"); if (!pDests) return nullptr; pValue = pDests->GetElementValue(sName); @@ -234,7 +234,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, if (CPDF_Array* pArray = pValue->AsArray()) return pArray; if (CPDF_Dictionary* pDict = pValue->AsDictionary()) - return pDict->GetArray("D"); + return pDict->GetArrayBy("D"); return nullptr; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ @@ -304,20 +304,20 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const { return FALSE; } if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { - csFileName = pDict->GetUnicodeText("UF"); + csFileName = pDict->GetUnicodeTextBy("UF"); if (csFileName.IsEmpty()) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("F")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("F")); } - if (pDict->GetString("FS") == "URL") { + if (pDict->GetStringBy("FS") == "URL") { return TRUE; } if (csFileName.IsEmpty()) { if (pDict->KeyExist("DOS")) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("DOS")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("DOS")); } else if (pDict->KeyExist("Mac")) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("Mac")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Mac")); } else if (pDict->KeyExist("Unix")) { - csFileName = CFX_WideString::FromLocal(pDict->GetString("Unix")); + csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Unix")); } else { return FALSE; } @@ -336,7 +336,7 @@ CPDF_FileSpec::CPDF_FileSpec() { } FX_BOOL CPDF_FileSpec::IsURL() const { if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) { - return pDict->GetString("FS") == "URL"; + return pDict->GetStringBy("FS") == "URL"; } return FALSE; } @@ -382,8 +382,8 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const { return nullptr; if (CPDF_Stream* pStream = m_pObj->AsStream()) return pStream; - if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict("EF")) - return pEF->GetStream("F"); + if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDictBy("EF")) + return pEF->GetStreamBy("F"); return nullptr; } static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, @@ -475,7 +475,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const { if (!pPDFRoot) { return wsLabel; } - CPDF_Dictionary* pLabels = pPDFRoot->GetDict("PageLabels"); + CPDF_Dictionary* pLabels = pPDFRoot->GetDictBy("PageLabels"); CPDF_NumberTree numberTree(pLabels); CPDF_Object* pValue = NULL; int n = nPage; @@ -490,10 +490,10 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const { pValue = pValue->GetDirect(); if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) { if (pLabel->KeyExist("P")) { - wsLabel += pLabel->GetUnicodeText("P"); + wsLabel += pLabel->GetUnicodeTextBy("P"); } - CFX_ByteString bsNumberingStyle = pLabel->GetString("S", NULL); - int nLabelNum = nPage - n + pLabel->GetInteger("St", 1); + CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", NULL); + int nLabelNum = nPage - n + pLabel->GetIntegerBy("St", 1); CFX_WideString wsNumPortion = _GetLabelNumPortion(nLabelNum, bsNumberingStyle); wsLabel += wsNumPortion; diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp index b435fc619c..53e90c0ae1 100644 --- a/core/src/fpdfdoc/doc_bookmark.cpp +++ b/core/src/fpdfdoc/doc_bookmark.cpp @@ -12,40 +12,40 @@ CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( const CPDF_Bookmark& parent) const { if (!parent.m_pDict) { - CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDict("Outlines"); + CPDF_Dictionary* pRoot = m_pDocument->GetRoot()->GetDictBy("Outlines"); if (!pRoot) { return CPDF_Bookmark(); } - return CPDF_Bookmark(pRoot->GetDict("First")); + return CPDF_Bookmark(pRoot->GetDictBy("First")); } - return CPDF_Bookmark(parent.m_pDict->GetDict("First")); + return CPDF_Bookmark(parent.m_pDict->GetDictBy("First")); } CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling( const CPDF_Bookmark& bookmark) const { if (!bookmark.m_pDict) { return CPDF_Bookmark(); } - CPDF_Dictionary* pNext = bookmark.m_pDict->GetDict("Next"); + CPDF_Dictionary* pNext = bookmark.m_pDict->GetDictBy("Next"); return pNext == bookmark.m_pDict ? CPDF_Bookmark() : CPDF_Bookmark(pNext); } FX_DWORD CPDF_Bookmark::GetColorRef() const { if (!m_pDict) { return 0; } - CPDF_Array* pColor = m_pDict->GetArray("C"); + CPDF_Array* pColor = m_pDict->GetArrayBy("C"); if (!pColor) { return FXSYS_RGB(0, 0, 0); } - int r = FXSYS_round(pColor->GetNumber(0) * 255); - int g = FXSYS_round(pColor->GetNumber(1) * 255); - int b = FXSYS_round(pColor->GetNumber(2) * 255); + int r = FXSYS_round(pColor->GetNumberAt(0) * 255); + int g = FXSYS_round(pColor->GetNumberAt(1) * 255); + int b = FXSYS_round(pColor->GetNumberAt(2) * 255); return FXSYS_RGB(r, g, b); } FX_DWORD CPDF_Bookmark::GetFontStyle() const { if (!m_pDict) { return 0; } - return m_pDict->GetInteger("F"); + return m_pDict->GetIntegerBy("F"); } CFX_WideString CPDF_Bookmark::GetTitle() const { if (!m_pDict) { @@ -87,5 +87,5 @@ CPDF_Action CPDF_Bookmark::GetAction() const { if (!m_pDict) { return CPDF_Action(); } - return CPDF_Action(m_pDict->GetDict("A")); + return CPDF_Action(m_pDict->GetDictBy("A")); } diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index c49f042b32..a061c852b5 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -234,17 +234,17 @@ CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP) if (!pRoot) return; - m_pFormDict = pRoot->GetDict("AcroForm"); + m_pFormDict = pRoot->GetDictBy("AcroForm"); if (!m_pFormDict) return; - CPDF_Array* pFields = m_pFormDict->GetArray("Fields"); + CPDF_Array* pFields = m_pFormDict->GetArrayBy("Fields"); if (!pFields) return; int count = pFields->GetCount(); for (int i = 0; i < count; i++) { - LoadField(pFields->GetDict(i)); + LoadField(pFields->GetDictAt(i)); } } @@ -301,7 +301,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName( if (!pResDict) { return csTmp; } - CPDF_Dictionary* pDict = pResDict->GetDict(csType); + CPDF_Dictionary* pDict = pResDict->GetDictBy(csType); if (!pDict) { return csTmp; } @@ -673,13 +673,13 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y, int* z_order) const { - CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots"); + CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots"); if (!pAnnotList) return nullptr; for (FX_DWORD i = pAnnotList->GetCount(); i > 0; --i) { FX_DWORD annot_index = i - 1; - CPDF_Dictionary* pAnnot = pAnnotList->GetDict(annot_index); + CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index); if (!pAnnot) continue; @@ -706,7 +706,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlByDict( } FX_BOOL CPDF_InterForm::NeedConstructAP() { - return m_pFormDict && m_pFormDict->GetBoolean("NeedAppearances"); + return m_pFormDict && m_pFormDict->GetBooleanBy("NeedAppearances"); } void CPDF_InterForm::NeedConstructAP(FX_BOOL bNeedAP) { if (!m_pFormDict) { @@ -719,14 +719,14 @@ int CPDF_InterForm::CountFieldsInCalculationOrder() { if (!m_pFormDict) { return 0; } - CPDF_Array* pArray = m_pFormDict->GetArray("CO"); + CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO"); return pArray ? pArray->GetCount() : 0; } CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) { if (!m_pFormDict || index < 0) { return NULL; } - CPDF_Array* pArray = m_pFormDict->GetArray("CO"); + CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO"); if (!pArray) { return NULL; } @@ -740,7 +740,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) { if (!m_pFormDict || !pField) { return -1; } - CPDF_Array* pArray = m_pFormDict->GetArray("CO"); + CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO"); if (!pArray) { return -1; } @@ -810,14 +810,14 @@ CPDF_DefaultAppearance CPDF_InterForm::GetDefaultAppearance() { if (!m_pFormDict) { return csDA; } - csDA = m_pFormDict->GetString("DA"); + csDA = m_pFormDict->GetStringBy("DA"); return csDA; } CPDF_Font* CPDF_InterForm::GetDefaultFormFont() { return GetDefaultInterFormFont(m_pFormDict, m_pDocument); } int CPDF_InterForm::GetFormAlignment() { - return m_pFormDict ? m_pFormDict->GetInteger("Q", 0) : 0; + return m_pFormDict ? m_pFormDict->GetIntegerBy("Q", 0) : 0; } bool CPDF_InterForm::ResetForm(const std::vector<CPDF_FormField*>& fields, @@ -865,18 +865,18 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { return; } FX_DWORD dwParentObjNum = pFieldDict->GetObjNum(); - CPDF_Array* pKids = pFieldDict->GetArray("Kids"); + CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (!pKids) { AddTerminalField(pFieldDict); return; } - CPDF_Dictionary* pFirstKid = pKids->GetDict(0); + CPDF_Dictionary* pFirstKid = pKids->GetDictAt(0); if (!pFirstKid) { return; } if (pFirstKid->KeyExist("T") || pFirstKid->KeyExist("Kids")) { for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pChildDict = pKids->GetDict(i); + CPDF_Dictionary* pChildDict = pKids->GetDictAt(i); if (pChildDict) { if (pChildDict->GetObjNum() != dwParentObjNum) { LoadField(pChildDict, nLevel + 1); @@ -888,21 +888,21 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { } } FX_BOOL CPDF_InterForm::HasXFAForm() const { - return m_pFormDict && m_pFormDict->GetArray("XFA"); + return m_pFormDict && m_pFormDict->GetArrayBy("XFA"); } void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) { CPDF_Dictionary* pPageDict = pPage->m_pFormDict; if (!pPageDict) { return; } - CPDF_Array* pAnnots = pPageDict->GetArray("Annots"); + CPDF_Array* pAnnots = pPageDict->GetArrayBy("Annots"); if (!pAnnots) { return; } int iAnnotCount = pAnnots->GetCount(); for (int i = 0; i < iAnnotCount; i++) { - CPDF_Dictionary* pAnnot = pAnnots->GetDict(i); - if (pAnnot && pAnnot->GetString("Subtype") == "Widget") { + CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i); + if (pAnnot && pAnnot->GetStringBy("Subtype") == "Widget") { LoadField(pAnnot); } } @@ -921,8 +921,8 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { if (!pField) { CPDF_Dictionary* pParent = pFieldDict; if (!pFieldDict->KeyExist("T") && - pFieldDict->GetString("Subtype") == "Widget") { - pParent = pFieldDict->GetDict("Parent"); + pFieldDict->GetStringBy("Subtype") == "Widget") { + pParent = pFieldDict->GetDictBy("Parent"); if (!pParent) { pParent = pFieldDict; } @@ -952,18 +952,18 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { } m_pFieldTree->SetField(csWName, pField); } - CPDF_Array* pKids = pFieldDict->GetArray("Kids"); + CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (!pKids) { - if (pFieldDict->GetString("Subtype") == "Widget") { + if (pFieldDict->GetStringBy("Subtype") == "Widget") { AddControl(pField, pFieldDict); } } else { for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } - if (pKid->GetString("Subtype") != "Widget") { + if (pKid->GetStringBy("Subtype") != "Widget") { continue; } AddControl(pField, pKid); @@ -1008,7 +1008,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields( bFind = pdfium::ContainsValue(*fields, pField); if (bIncludeOrExclude == bFind) { CPDF_Dictionary* pFieldDict = pField->m_pDict; - if ((dwFlags & 0x02) != 0 && pFieldDict->GetString("V").IsEmpty()) { + if ((dwFlags & 0x02) != 0 && pFieldDict->GetStringBy("V").IsEmpty()) { return pField; } } @@ -1034,7 +1034,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( if (!pDoc) { return NULL; } - CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDict("FDF"); + CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDictBy("FDF"); if (!pdf_path.IsEmpty()) { if (bSimpleFileSpec) { CFX_WideString wsFilePath = FILESPEC_EncodeFileName(pdf_path); @@ -1059,7 +1059,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( continue; if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) { - if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetString("V").IsEmpty()) + if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringBy("V").IsEmpty()) continue; CFX_WideString fullname = GetFullName(pField->GetFieldDict()); @@ -1096,7 +1096,7 @@ const struct _SupportFieldEncoding { static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary* pFieldDict, CFX_WideString& csValue, CFX_ByteString& bsEncoding) { - CFX_ByteString csBValue = pFieldDict->GetString("V"); + CFX_ByteString csBValue = pFieldDict->GetStringBy("V"); int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); int32_t i = 0; for (; i < iCount; ++i) @@ -1125,11 +1125,11 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, if (!parent_name.IsEmpty()) { name = parent_name + L"."; } - name += pFieldDict->GetUnicodeText("T"); - CPDF_Array* pKids = pFieldDict->GetArray("Kids"); + name += pFieldDict->GetUnicodeTextBy("T"); + CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (pKids) { for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDict(i); + CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; } @@ -1189,15 +1189,15 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, if (!pFDF) { return FALSE; } - CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); + CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictBy("FDF"); if (!pMainDict) { return FALSE; } - CPDF_Array* pFields = pMainDict->GetArray("Fields"); + CPDF_Array* pFields = pMainDict->GetArrayBy("Fields"); if (!pFields) { return FALSE; } - m_bsEncoding = pMainDict->GetString("Encoding"); + m_bsEncoding = pMainDict->GetStringBy("Encoding"); if (bNotify && m_pFormNotify) { int iRet = m_pFormNotify->BeforeFormImportData(this); if (iRet < 0) { @@ -1205,7 +1205,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, } } for (FX_DWORD i = 0; i < pFields->GetCount(); i++) { - CPDF_Dictionary* pField = pFields->GetDict(i); + CPDF_Dictionary* pField = pFields->GetDictAt(i); if (!pField) { continue; } diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp index 1ec98bb986..feaff38f16 100644 --- a/core/src/fpdfdoc/doc_formcontrol.cpp +++ b/core/src/fpdfdoc/doc_formcontrol.cpp @@ -15,17 +15,17 @@ CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, m_pForm = m_pField->m_pForm; } CFX_FloatRect CPDF_FormControl::GetRect() const { - return m_pWidgetDict->GetRect("Rect"); + return m_pWidgetDict->GetRectBy("Rect"); } CFX_ByteString CPDF_FormControl::GetOnStateName() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn; - CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP"); + CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP"); if (!pAP) { return csOn; } - CPDF_Dictionary* pN = pAP->GetDict("N"); + CPDF_Dictionary* pN = pAP->GetDictBy("N"); if (!pN) { return csOn; } @@ -46,11 +46,11 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) { if (csValue == "Off") { csValue = "Yes"; } - CFX_ByteString csAS = m_pWidgetDict->GetString("AS", "Off"); + CFX_ByteString csAS = m_pWidgetDict->GetStringBy("AS", "Off"); if (csAS != "Off") { m_pWidgetDict->SetAtName("AS", csValue); } - CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP"); + CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP"); if (!pAP) { return; } @@ -103,7 +103,7 @@ CFX_WideString CPDF_FormControl::GetExportValue() { if (CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"))) { int iIndex = m_pField->GetControlIndex(this); - csOn = pArray->GetString(iIndex); + csOn = pArray->GetStringAt(iIndex); } } if (csOn.IsEmpty()) { @@ -116,7 +116,7 @@ FX_BOOL CPDF_FormControl::IsChecked() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); - CFX_ByteString csAS = m_pWidgetDict->GetString("AS"); + CFX_ByteString csAS = m_pWidgetDict->GetStringBy("AS"); return csAS == csOn; } FX_BOOL CPDF_FormControl::IsDefaultChecked() { @@ -134,7 +134,7 @@ void CPDF_FormControl::CheckControl(FX_BOOL bChecked) { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); - CFX_ByteString csOldAS = m_pWidgetDict->GetString("AS", "Off"); + CFX_ByteString csOldAS = m_pWidgetDict->GetStringBy("AS", "Off"); CFX_ByteString csAS = "Off"; if (bChecked) { csAS = csOn; @@ -152,22 +152,22 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { - if (m_pWidgetDict->GetInteger("F") & ANNOTFLAG_HIDDEN) { + if (m_pWidgetDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN) { return; } CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode); if (!pStream) { return; } - CFX_FloatRect form_bbox = pStream->GetDict()->GetRect("BBox"); - CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix("Matrix"); + CFX_FloatRect form_bbox = pStream->GetDict()->GetRectBy("BBox"); + CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixBy("Matrix"); form_matrix.TransformRect(form_bbox); - CFX_FloatRect arect = m_pWidgetDict->GetRect("Rect"); + CFX_FloatRect arect = m_pWidgetDict->GetRectBy("Rect"); CFX_Matrix matrix; matrix.MatchRect(arect, form_bbox); matrix.Concat(*pMatrix); CPDF_Form form(m_pField->m_pForm->m_pDocument, - m_pField->m_pForm->m_pFormDict->GetDict("DR"), pStream); + m_pField->m_pForm->m_pFormDict->GetDictBy("DR"), pStream); form.ParseContent(NULL, NULL, NULL, NULL); CPDF_RenderContext context(pPage); context.AppendLayer(&form, &matrix); @@ -180,7 +180,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() { if (!m_pWidgetDict) { return Invert; } - CFX_ByteString csH = m_pWidgetDict->GetString("H", "I"); + CFX_ByteString csH = m_pWidgetDict->GetStringBy("H", "I"); for (int i = 0; g_sHighlightingMode[i]; ++i) { if (csH.Equal(g_sHighlightingMode[i])) return static_cast<HighlightingMode>(i); @@ -189,7 +189,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() { } CPDF_ApSettings CPDF_FormControl::GetMK() const { - return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDict("MK") + return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDictBy("MK") : nullptr); } @@ -235,7 +235,7 @@ CPDF_Action CPDF_FormControl::GetAction() { return CPDF_Action(); } if (m_pWidgetDict->KeyExist("A")) { - return CPDF_Action(m_pWidgetDict->GetDict("A")); + return CPDF_Action(m_pWidgetDict->GetDictBy("A")); } CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A"); if (!pObj) { @@ -248,7 +248,7 @@ CPDF_AAction CPDF_FormControl::GetAdditionalAction() { return nullptr; } if (m_pWidgetDict->KeyExist("AA")) { - return m_pWidgetDict->GetDict("AA"); + return m_pWidgetDict->GetDictBy("AA"); } return m_pField->GetAdditionalAction(); } @@ -257,7 +257,7 @@ CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() { return CFX_ByteString(); } if (m_pWidgetDict->KeyExist("DA")) { - return m_pWidgetDict->GetString("DA"); + return m_pWidgetDict->GetStringBy("DA"); } CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "DA"); if (!pObj) { @@ -276,9 +276,9 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR"); if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { - CPDF_Dictionary* pFonts = pDict->GetDict("Font"); + CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); if (pFonts) { - CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag); if (pElement) { CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); if (pFont) { @@ -290,12 +290,12 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag)) return pFormFont; - CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDict("P"); + CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictBy("P"); pObj = FPDF_GetFieldAttr(pPageDict, "Resources"); if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { - CPDF_Dictionary* pFonts = pDict->GetDict("Font"); + CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); if (pFonts) { - CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag); if (pElement) { CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); if (pFont) { @@ -312,7 +312,7 @@ int CPDF_FormControl::GetControlAlignment() { return 0; } if (m_pWidgetDict->KeyExist("Q")) { - return m_pWidgetDict->GetInteger("Q", 0); + return m_pWidgetDict->GetIntegerBy("Q", 0); } CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q"); if (pObj) @@ -327,7 +327,7 @@ bool CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry) const { } int CPDF_ApSettings::GetRotation() const { - return m_pDict ? m_pDict->GetInteger("R") : 0; + return m_pDict ? m_pDict->GetIntegerBy("R") : 0; } FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, @@ -336,7 +336,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, if (!m_pDict) return 0; - CPDF_Array* pEntry = m_pDict->GetArray(csEntry); + CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); if (!pEntry) return 0; @@ -344,20 +344,20 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, FX_DWORD dwCount = pEntry->GetCount(); if (dwCount == 1) { iColorType = COLORTYPE_GRAY; - FX_FLOAT g = pEntry->GetNumber(0) * 255; + FX_FLOAT g = pEntry->GetNumberAt(0) * 255; color = ArgbEncode(255, (int)g, (int)g, (int)g); } else if (dwCount == 3) { iColorType = COLORTYPE_RGB; - FX_FLOAT r = pEntry->GetNumber(0) * 255; - FX_FLOAT g = pEntry->GetNumber(1) * 255; - FX_FLOAT b = pEntry->GetNumber(2) * 255; + FX_FLOAT r = pEntry->GetNumberAt(0) * 255; + FX_FLOAT g = pEntry->GetNumberAt(1) * 255; + FX_FLOAT b = pEntry->GetNumberAt(2) * 255; color = ArgbEncode(255, (int)r, (int)g, (int)b); } else if (dwCount == 4) { iColorType = COLORTYPE_CMYK; - FX_FLOAT c = pEntry->GetNumber(0); - FX_FLOAT m = pEntry->GetNumber(1); - FX_FLOAT y = pEntry->GetNumber(2); - FX_FLOAT k = pEntry->GetNumber(3); + FX_FLOAT c = pEntry->GetNumberAt(0); + FX_FLOAT m = pEntry->GetNumberAt(1); + FX_FLOAT y = pEntry->GetNumberAt(2); + FX_FLOAT k = pEntry->GetNumberAt(3); FX_FLOAT r = 1.0f - std::min(1.0f, c + k); FX_FLOAT g = 1.0f - std::min(1.0f, m + k); FX_FLOAT b = 1.0f - std::min(1.0f, y + k); @@ -372,8 +372,8 @@ FX_FLOAT CPDF_ApSettings::GetOriginalColor( if (!m_pDict) return 0; - CPDF_Array* pEntry = m_pDict->GetArray(csEntry); - return pEntry ? pEntry->GetNumber(index) : 0; + CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); + return pEntry ? pEntry->GetNumberAt(index) : 0; } void CPDF_ApSettings::GetOriginalColor(int& iColorType, @@ -386,41 +386,42 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType, if (!m_pDict) { return; } - CPDF_Array* pEntry = m_pDict->GetArray(csEntry); + CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry); if (!pEntry) { return; } FX_DWORD dwCount = pEntry->GetCount(); if (dwCount == 1) { iColorType = COLORTYPE_GRAY; - fc[0] = pEntry->GetNumber(0); + fc[0] = pEntry->GetNumberAt(0); } else if (dwCount == 3) { iColorType = COLORTYPE_RGB; - fc[0] = pEntry->GetNumber(0); - fc[1] = pEntry->GetNumber(1); - fc[2] = pEntry->GetNumber(2); + fc[0] = pEntry->GetNumberAt(0); + fc[1] = pEntry->GetNumberAt(1); + fc[2] = pEntry->GetNumberAt(2); } else if (dwCount == 4) { iColorType = COLORTYPE_CMYK; - fc[0] = pEntry->GetNumber(0); - fc[1] = pEntry->GetNumber(1); - fc[2] = pEntry->GetNumber(2); - fc[3] = pEntry->GetNumber(3); + fc[0] = pEntry->GetNumberAt(0); + fc[1] = pEntry->GetNumberAt(1); + fc[2] = pEntry->GetNumberAt(2); + fc[3] = pEntry->GetNumberAt(3); } } CFX_WideString CPDF_ApSettings::GetCaption( const CFX_ByteStringC& csEntry) const { - return m_pDict ? m_pDict->GetUnicodeText(csEntry) : CFX_WideString(); + return m_pDict ? m_pDict->GetUnicodeTextBy(csEntry) : CFX_WideString(); } CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) const { - return m_pDict ? m_pDict->GetStream(csEntry) : nullptr; + return m_pDict ? m_pDict->GetStreamBy(csEntry) : nullptr; } CPDF_IconFit CPDF_ApSettings::GetIconFit() const { - return m_pDict ? m_pDict->GetDict("IF") : nullptr; + return m_pDict ? m_pDict->GetDictBy("IF") : nullptr; } int CPDF_ApSettings::GetTextPosition() const { - return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION; + return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) + : TEXTPOS_CAPTION; } diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp index dc31938b16..b309e82575 100644 --- a/core/src/fpdfdoc/doc_formfield.cpp +++ b/core/src/fpdfdoc/doc_formfield.cpp @@ -408,7 +408,7 @@ int CPDF_FormField::GetMaxLen() { CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict; if (pWidgetDict->KeyExist("MaxLen")) - return pWidgetDict->GetInteger("MaxLen"); + return pWidgetDict->GetIntegerBy("MaxLen"); } return 0; } @@ -873,7 +873,7 @@ int CPDF_FormField::GetSelectedOptionIndex(int index) { } int iCount = (int)pArray->GetCount(); if (iCount > 0 && index < iCount) { - return pArray->GetInteger(index); + return pArray->GetIntegerAt(index); } return -1; } @@ -888,7 +888,7 @@ FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) { } int iCount = (int)pArray->GetCount(); for (int i = 0; i < iCount; i++) { - if (pArray->GetInteger(i) == iOptIndex) { + if (pArray->GetIntegerAt(i) == iOptIndex) { return TRUE; } } @@ -897,7 +897,7 @@ FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) { FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL bNotify) { - CPDF_Array* pArray = m_pDict->GetArray("I"); + CPDF_Array* pArray = m_pDict->GetArrayBy("I"); if (!pArray) { if (!bSelected) { return TRUE; @@ -907,7 +907,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, } FX_BOOL bReturn = FALSE; for (int i = 0; i < (int)pArray->GetCount(); i++) { - int iFind = pArray->GetInteger(i); + int iFind = pArray->GetIntegerAt(i); if (iFind == iOptIndex) { if (bSelected) { return TRUE; @@ -1006,7 +1006,7 @@ void CPDF_FormField::LoadDA() { DA = pObj_t->GetString(); } if (DA.IsEmpty() && m_pForm->m_pFormDict) { - DA = m_pForm->m_pFormDict->GetString("DA"); + DA = m_pForm->m_pFormDict->GetStringBy("DA"); } if (DA.IsEmpty()) { return; @@ -1015,10 +1015,11 @@ void CPDF_FormField::LoadDA() { syntax.FindTagParam("Tf", 2); CFX_ByteString font_name = syntax.GetWord(); CPDF_Dictionary* pFontDict = NULL; - if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && - m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")) - pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict( - font_name); + if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDictBy("DR") && + m_pForm->m_pFormDict->GetDictBy("DR")->GetDictBy("Font")) + pFontDict = m_pForm->m_pFormDict->GetDictBy("DR") + ->GetDictBy("Font") + ->GetDictBy(font_name); if (!pFontDict) { return; diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index b7ddb7e61c..6617e85cd4 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -56,20 +56,20 @@ CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage, void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, std::vector<CPDF_Dictionary*>* pList) { - CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArray("Annots"); + CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots"); if (!pAnnotList) return; for (FX_DWORD i = 0; i < pAnnotList->GetCount(); ++i) { - CPDF_Dictionary* pAnnot = pAnnotList->GetDict(i); - bool add_link = (pAnnot && pAnnot->GetString("Subtype") == "Link"); + CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i); + bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link"); // Add non-links as nullptrs to preserve z-order. pList->push_back(add_link ? pAnnot : nullptr); } } CPDF_Rect CPDF_Link::GetRect() { - return m_pDict->GetRect("Rect"); + return m_pDict->GetRectBy("Rect"); } CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { CPDF_Object* pDest = m_pDict->GetElementValue("Dest"); @@ -86,5 +86,5 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { return CPDF_Dest(); } CPDF_Action CPDF_Link::GetAction() { - return CPDF_Action(m_pDict->GetDict("A")); + return CPDF_Action(m_pDict->GetDictBy("A")); } diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp index f25007351b..593cffbebb 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -12,7 +12,7 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) { if (!pRoot) return; - CPDF_Stream* pStream = pRoot->GetStream("Metadata"); + CPDF_Stream* pStream = pRoot->GetStreamBy("Metadata"); if (!pStream) return; diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index 539c038b41..a18924c1dc 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -14,7 +14,7 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject, if (const CPDF_Array* pArray = pObject->AsArray()) { FX_DWORD dwCount = pArray->GetCount(); for (FX_DWORD i = 0; i < dwCount; i++) { - if (pArray->GetDict(i) == pGroupDict) + if (pArray->GetDictAt(i) == pGroupDict) return i; } return -1; @@ -32,7 +32,7 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict, if (CPDF_Array* pArray = pIntent->AsArray()) { FX_DWORD dwCount = pArray->GetCount(); for (FX_DWORD i = 0; i < dwCount; i++) { - bsIntent = pArray->GetString(i); + bsIntent = pArray->GetStringAt(i); if (bsIntent == "All" || bsIntent == csElement) return TRUE; } @@ -45,24 +45,24 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc, const CPDF_Dictionary* pOCGDict, const CFX_ByteStringC& bsState) { FXSYS_assert(pDoc && pOCGDict); - CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDict("OCProperties"); + CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDictBy("OCProperties"); if (!pOCProperties) { return NULL; } - CPDF_Array* pOCGs = pOCProperties->GetArray("OCGs"); + CPDF_Array* pOCGs = pOCProperties->GetArrayBy("OCGs"); if (!pOCGs) { return NULL; } if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) { return NULL; } - CPDF_Dictionary* pConfig = pOCProperties->GetDict("D"); - CPDF_Array* pConfigs = pOCProperties->GetArray("Configs"); + CPDF_Dictionary* pConfig = pOCProperties->GetDictBy("D"); + CPDF_Array* pConfigs = pOCProperties->GetArrayBy("Configs"); if (pConfigs) { CPDF_Dictionary* pFind; int32_t iCount = pConfigs->GetCount(); for (int32_t i = 0; i < iCount; i++) { - pFind = pConfigs->GetDict(i); + pFind = pConfigs->GetDictAt(i); if (!pFind) { continue; } @@ -104,43 +104,43 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, return TRUE; } bValidConfig = TRUE; - FX_BOOL bState = pConfig->GetString("BaseState", "ON") != "OFF"; - CPDF_Array* pArray = pConfig->GetArray("ON"); + FX_BOOL bState = pConfig->GetStringBy("BaseState", "ON") != "OFF"; + CPDF_Array* pArray = pConfig->GetArrayBy("ON"); if (pArray) { if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) { bState = TRUE; } } - pArray = pConfig->GetArray("OFF"); + pArray = pConfig->GetArrayBy("OFF"); if (pArray) { if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) { bState = FALSE; } } - pArray = pConfig->GetArray("AS"); + pArray = pConfig->GetArrayBy("AS"); if (pArray) { CFX_ByteString csFind = csConfig + "State"; int32_t iCount = pArray->GetCount(); for (int32_t i = 0; i < iCount; i++) { - CPDF_Dictionary* pUsage = pArray->GetDict(i); + CPDF_Dictionary* pUsage = pArray->GetDictAt(i); if (!pUsage) { continue; } - if (pUsage->GetString("Event", "View") != csConfig) { + if (pUsage->GetStringBy("Event", "View") != csConfig) { continue; } - CPDF_Array* pOCGs = pUsage->GetArray("OCGs"); + CPDF_Array* pOCGs = pUsage->GetArrayBy("OCGs"); if (!pOCGs) { continue; } if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) { continue; } - CPDF_Dictionary* pState = pUsage->GetDict(csConfig); + CPDF_Dictionary* pState = pUsage->GetDictBy(csConfig); if (!pState) { continue; } - bState = pState->GetString(csFind) != "OFF"; + bState = pState->GetStringBy(csFind) != "OFF"; } } return bState; @@ -150,19 +150,19 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const { return TRUE; } CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType); - CPDF_Dictionary* pUsage = pOCGDict->GetDict("Usage"); + CPDF_Dictionary* pUsage = pOCGDict->GetDictBy("Usage"); if (pUsage) { - CPDF_Dictionary* pState = pUsage->GetDict(csState); + CPDF_Dictionary* pState = pUsage->GetDictBy(csState); if (pState) { CFX_ByteString csFind = csState + "State"; if (pState->KeyExist(csFind)) { - return pState->GetString(csFind) != "OFF"; + return pState->GetStringBy(csFind) != "OFF"; } } if (csState != "View") { - pState = pUsage->GetDict("View"); + pState = pUsage->GetDictBy("View"); if (pState && pState->KeyExist("ViewState")) { - return pState->GetString("ViewState") != "OFF"; + return pState->GetStringBy("ViewState") != "OFF"; } } } @@ -194,7 +194,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, } int32_t iCount = pExpression->GetCount(); CPDF_Object* pOCGObj; - CFX_ByteString csOperator = pExpression->GetString(0); + CFX_ByteString csOperator = pExpression->GetStringAt(0); if (csOperator == "Not") { pOCGObj = pExpression->GetElementValue(1); if (!pOCGObj) @@ -234,11 +234,11 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, } FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict, FX_BOOL bFromConfig) { - CPDF_Array* pVE = pOCMDDict->GetArray("VE"); + CPDF_Array* pVE = pOCMDDict->GetArrayBy("VE"); if (pVE) { return GetOCGVE(pVE, bFromConfig); } - CFX_ByteString csP = pOCMDDict->GetString("P", "AnyOn"); + CFX_ByteString csP = pOCMDDict->GetStringBy("P", "AnyOn"); CPDF_Object* pOCGObj = pOCMDDict->GetElementValue("OCGs"); if (!pOCGObj) return TRUE; @@ -256,7 +256,7 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict, int32_t iCount = pArray->GetCount(); for (int32_t i = 0; i < iCount; i++) { FX_BOOL bItem = TRUE; - CPDF_Dictionary* pItemDict = pArray->GetDict(i); + CPDF_Dictionary* pItemDict = pArray->GetDictAt(i); if (pItemDict) bItem = bFromConfig ? LoadOCGState(pItemDict) : GetOCGVisible(pItemDict); @@ -271,7 +271,7 @@ FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) { if (!pOCGDict) { return TRUE; } - CFX_ByteString csType = pOCGDict->GetString("Type", "OCG"); + CFX_ByteString csType = pOCGDict->GetStringBy("Type", "OCG"); if (csType == "OCG") { return GetOCGVisible(pOCGDict); } diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp index 3510eb6c8e..bf623eb703 100644 --- a/core/src/fpdfdoc/doc_tagged.cpp +++ b/core/src/fpdfdoc/doc_tagged.cpp @@ -12,8 +12,8 @@ const int nMaxRecursion = 32; static FX_BOOL IsTagged(const CPDF_Document* pDoc) { CPDF_Dictionary* pCatalog = pDoc->GetRoot(); - CPDF_Dictionary* pMarkInfo = pCatalog->GetDict("MarkInfo"); - return pMarkInfo != NULL && pMarkInfo->GetInteger("Marked"); + CPDF_Dictionary* pMarkInfo = pCatalog->GetDictBy("MarkInfo"); + return pMarkInfo != NULL && pMarkInfo->GetIntegerBy("Marked"); } CPDF_StructTree* CPDF_StructTree::LoadPage(const CPDF_Document* pDoc, const CPDF_Dictionary* pPageDict) { @@ -34,11 +34,11 @@ CPDF_StructTree* CPDF_StructTree::LoadDoc(const CPDF_Document* pDoc) { } CPDF_StructTreeImpl::CPDF_StructTreeImpl(const CPDF_Document* pDoc) { CPDF_Dictionary* pCatalog = pDoc->GetRoot(); - m_pTreeRoot = pCatalog->GetDict("StructTreeRoot"); + m_pTreeRoot = pCatalog->GetDictBy("StructTreeRoot"); if (!m_pTreeRoot) { return; } - m_pRoleMap = m_pTreeRoot->GetDict("RoleMap"); + m_pRoleMap = m_pTreeRoot->GetDictBy("RoleMap"); } CPDF_StructTreeImpl::~CPDF_StructTreeImpl() { for (int i = 0; i < m_Kids.GetSize(); i++) @@ -65,7 +65,7 @@ void CPDF_StructTreeImpl::LoadDocTree() { return; for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { - CPDF_Dictionary* pKid = pArray->GetDict(i); + CPDF_Dictionary* pKid = pArray->GetDictAt(i); CPDF_StructElementImpl* pStructElementImpl = new CPDF_StructElementImpl(this, nullptr, pKid); m_Kids.Add(pStructElementImpl); @@ -94,19 +94,19 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) { m_Kids[i] = NULL; } std::map<CPDF_Dictionary*, CPDF_StructElementImpl*> element_map; - CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict("ParentTree"); + CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictBy("ParentTree"); if (!pParentTree) { return; } CPDF_NumberTree parent_tree(pParentTree); - int parents_id = pPageDict->GetInteger("StructParents", -1); + int parents_id = pPageDict->GetIntegerBy("StructParents", -1); if (parents_id >= 0) { CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id)); if (!pParentArray) return; for (i = 0; i < pParentArray->GetCount(); i++) { - CPDF_Dictionary* pParent = pParentArray->GetDict(i); + CPDF_Dictionary* pParent = pParentArray->GetDictAt(i); if (!pParent) { continue; } @@ -128,8 +128,8 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode( CPDF_StructElementImpl* pElement = new CPDF_StructElementImpl(this, NULL, pDict); map[pDict] = pElement; - CPDF_Dictionary* pParent = pDict->GetDict("P"); - if (!pParent || pParent->GetString("Type") == "StructTreeRoot") { + CPDF_Dictionary* pParent = pDict->GetDictBy("P"); + if (!pParent || pParent->GetStringBy("Type") == "StructTreeRoot") { if (!AddTopLevelNode(pDict, pElement)) { pElement->Release(); map.erase(pDict); @@ -197,9 +197,9 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, : m_RefCount(0) { m_pTree = pTree; m_pDict = pDict; - m_Type = pDict->GetString("S"); + m_Type = pDict->GetStringBy("S"); if (pTree->m_pRoleMap) { - CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type); + CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type); if (!mapped.IsEmpty()) { m_Type = mapped; } @@ -269,7 +269,7 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum, if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("Pg"))) PageObjNum = pRef->GetRefObjNum(); - CFX_ByteString type = pKidDict->GetString("Type"); + CFX_ByteString type = pKidDict->GetStringBy("Type"); if (type == "MCR") { if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) { return; @@ -281,7 +281,7 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum, pKid->m_StreamContent.m_RefObjNum = 0; } pKid->m_StreamContent.m_PageObjNum = PageObjNum; - pKid->m_StreamContent.m_ContentId = pKidDict->GetInteger("MCID"); + pKid->m_StreamContent.m_ContentId = pKidDict->GetIntegerBy("MCID"); } else if (type == "OBJR") { if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) { return; @@ -325,7 +325,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, return pDict; } } - if (pDict && pDict->GetString("O") == owner) + if (pDict && pDict->GetStringBy("O") == owner) return pDict; return nullptr; } @@ -360,22 +360,22 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, if (!pC) return nullptr; - CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDict("ClassMap"); + CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictBy("ClassMap"); if (!pClassMap) return nullptr; if (CPDF_Array* pArray = pC->AsArray()) { for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { - CFX_ByteString class_name = pArray->GetString(i); - CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); - if (pClassDict && pClassDict->GetString("O") == owner) + CFX_ByteString class_name = pArray->GetStringAt(i); + CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); + if (pClassDict && pClassDict->GetStringBy("O") == owner) return pClassDict->GetElementValue(name); } return nullptr; } CFX_ByteString class_name = pC->GetString(); - CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name); - if (pClassDict && pClassDict->GetString("O") == owner) + CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); + if (pClassDict && pClassDict->GetStringBy("O") == owner) return pClassDict->GetElementValue(name); return nullptr; } @@ -412,9 +412,9 @@ FX_ARGB CPDF_StructElementImpl::GetColor(const CFX_ByteStringC& owner, CPDF_Array* pArray = ToArray(GetAttr(owner, name, bInheritable, subindex)); if (!pArray) return default_value; - return 0xff000000 | ((int)(pArray->GetNumber(0) * 255) << 16) | - ((int)(pArray->GetNumber(1) * 255) << 8) | - (int)(pArray->GetNumber(2) * 255); + return 0xff000000 | ((int)(pArray->GetNumberAt(0) * 255) << 16) | + ((int)(pArray->GetNumberAt(1) * 255) << 8) | + (int)(pArray->GetNumberAt(2) * 255); } FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index 4856cb51e5..7db2887834 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -15,7 +15,7 @@ CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) { CFX_WideString full_name; CPDF_Dictionary* pLevel = pFieldDict; while (pLevel) { - CFX_WideString short_name = pLevel->GetUnicodeText("T"); + CFX_WideString short_name = pLevel->GetUnicodeTextBy("T"); if (short_name != L"") { if (full_name == L"") { full_name = short_name; @@ -23,7 +23,7 @@ CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) { full_name = short_name + L"." + full_name; } } - pLevel = pLevel->GetDict("Parent"); + pLevel = pLevel->GetDictBy("Parent"); } return full_name; } @@ -272,11 +272,11 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { if (!pFormDict) { return 0; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return 0; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return 0; } @@ -287,7 +287,7 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { continue; } if (CPDF_Dictionary* pDirect = ToDictionary(pObj->GetDirect())) { - if (pDirect->GetString("Type") == "Font") { + if (pDirect->GetStringBy("Type") == "Font") { dwCount++; } } @@ -301,11 +301,11 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } @@ -319,7 +319,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") + if (pElement->GetStringBy("Type") != "Font") continue; if (dwCount == index) { csNameTag = csKey; @@ -336,19 +336,19 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict || csAlias.IsEmpty()) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } - CPDF_Dictionary* pElement = pFonts->GetDict(csAlias); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias); if (!pElement) { return NULL; } - if (pElement->GetString("Type") == "Font") { + if (pElement->GetStringBy("Type") == "Font") { return pDocument->LoadFont(pElement); } return NULL; @@ -360,11 +360,11 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict || csFontName.IsEmpty()) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } @@ -377,7 +377,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") + if (pElement->GetStringBy("Type") != "Font") continue; CPDF_Font* pFind = pDocument->LoadFont(pElement); @@ -401,11 +401,11 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return NULL; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return NULL; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return NULL; } @@ -418,7 +418,7 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") + if (pElement->GetStringBy("Type") != "Font") continue; CPDF_Font* pFind = pDocument->LoadFont(pElement); if (!pFind) { @@ -457,11 +457,11 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict || !pFont) { return FALSE; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return FALSE; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return FALSE; } @@ -474,7 +474,7 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") { + if (pElement->GetStringBy("Type") != "Font") { continue; } if (pFont->GetFontDict() == pElement) { @@ -492,11 +492,11 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return FALSE; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return FALSE; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return FALSE; } @@ -512,7 +512,7 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetString("Type") != "Font") { + if (pElement->GetStringBy("Type") != "Font") { continue; } pFont = pDocument->LoadFont(pElement); @@ -547,12 +547,12 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, if (!pFormDict) { InitInterFormDict(pFormDict, pDocument); } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { pDR = new CPDF_Dictionary; pFormDict->SetAt("DR", pDR); } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { pFonts = new CPDF_Dictionary; pDR->SetAt("Font", pFonts); @@ -605,19 +605,19 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) { if (!FindInterFormFont(pFormDict, pFont, csTag)) { return; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); pFonts->RemoveAt(csTag); } void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { if (!pFormDict || csNameTag.IsEmpty()) { return; } - CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); + CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR"); if (!pDR) { return; } - CPDF_Dictionary* pFonts = pDR->GetDict("Font"); + CPDF_Dictionary* pFonts = pDR->GetDictBy("Font"); if (!pFonts) { return; } @@ -628,7 +628,7 @@ CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, if (!pFormDict) { return NULL; } - CPDF_DefaultAppearance cDA = pFormDict->GetString("DA"); + CPDF_DefaultAppearance cDA = pFormDict->GetStringBy("DA"); CFX_ByteString csFontNameTag; FX_FLOAT fFontSize; cDA.GetFont(csFontNameTag, fFontSize); @@ -638,7 +638,7 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() { if (!m_pDict) { return Always; } - CFX_ByteString csSW = m_pDict->GetString("SW", "A"); + CFX_ByteString csSW = m_pDict->GetStringBy("SW", "A"); if (csSW == "B") { return Bigger; } @@ -654,21 +654,21 @@ FX_BOOL CPDF_IconFit::IsProportionalScale() { if (!m_pDict) { return TRUE; } - return m_pDict->GetString("S", "P") != "A"; + return m_pDict->GetStringBy("S", "P") != "A"; } void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { fLeft = fBottom = 0.5; if (!m_pDict) { return; } - CPDF_Array* pA = m_pDict->GetArray("A"); + CPDF_Array* pA = m_pDict->GetArrayBy("A"); if (pA) { FX_DWORD dwCount = pA->GetCount(); if (dwCount > 0) { - fLeft = pA->GetNumber(0); + fLeft = pA->GetNumberAt(0); } if (dwCount > 1) { - fBottom = pA->GetNumber(1); + fBottom = pA->GetNumberAt(1); } } } @@ -676,7 +676,7 @@ FX_BOOL CPDF_IconFit::GetFittingBounds() { if (!m_pDict) { return FALSE; } - return m_pDict->GetBoolean("FB"); + return m_pDict->GetBooleanBy("FB"); } void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray) { @@ -702,7 +702,7 @@ CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, if (pAttr) { return pAttr; } - CPDF_Dictionary* pParent = pFieldDict->GetDict("Parent"); + CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); if (!pParent) { return NULL; } diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp index 05f50c03d0..6ef09255c6 100644 --- a/core/src/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp @@ -11,43 +11,43 @@ CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {} FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return FALSE; } - return "R2L" == pDict->GetString("Direction"); + return "R2L" == pDict->GetStringBy("Direction"); } FX_BOOL CPDF_ViewerPreferences::PrintScaling() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return TRUE; } - return "None" != pDict->GetString("PrintScaling"); + return "None" != pDict->GetStringBy("PrintScaling"); } int32_t CPDF_ViewerPreferences::NumCopies() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return 1; } - return pDict->GetInteger("NumCopies"); + return pDict->GetIntegerBy("NumCopies"); } CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); CPDF_Array* pRange = NULL; - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return pRange; } - pRange = pDict->GetArray("PrintPageRange"); + pRange = pDict->GetArrayBy("PrintPageRange"); return pRange; } CFX_ByteString CPDF_ViewerPreferences::Duplex() const { CPDF_Dictionary* pDict = m_pDoc->GetRoot(); - pDict = pDict->GetDict("ViewerPreferences"); + pDict = pDict->GetDictBy("ViewerPreferences"); if (!pDict) { return "None"; } - return pDict->GetString("Duplex"); + return pDict->GetStringBy("Duplex"); } |