summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-09-15 10:15:32 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-15 10:15:32 -0700
commit38fd84428a1ea007a043be0b7d9b289e47aa5da0 (patch)
tree2bae09e8ae60d6d86e451eb7fa212f7aa9d899a8 /core/fpdfdoc
parent41d6bbe3d413e7854be89142b70c42a89e315cba (diff)
downloadpdfium-38fd84428a1ea007a043be0b7d9b289e47aa5da0.tar.xz
Rename dictionary set and get methods
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For. BUG=pdfium:596 Review-Url: https://codereview.chromium.org/2334323005
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_aaction.cpp2
-rw-r--r--core/fpdfdoc/cpdf_action.cpp28
-rw-r--r--core/fpdfdoc/cpdf_actionfields.cpp18
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp38
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp28
-rw-r--r--core/fpdfdoc/cpdf_apsettings.cpp16
-rw-r--r--core/fpdfdoc/cpdf_bookmark.cpp10
-rw-r--r--core/fpdfdoc/cpdf_bookmarktree.cpp8
-rw-r--r--core/fpdfdoc/cpdf_filespec.cpp18
-rw-r--r--core/fpdfdoc/cpdf_filespec_unittest.cpp8
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp48
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp80
-rw-r--r--core/fpdfdoc/cpdf_formfield_unittest.cpp14
-rw-r--r--core/fpdfdoc/cpdf_iconfit.cpp8
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp162
-rw-r--r--core/fpdfdoc/cpdf_link.cpp6
-rw-r--r--core/fpdfdoc/cpdf_linklist.cpp4
-rw-r--r--core/fpdfdoc/cpdf_metadata.cpp2
-rw-r--r--core/fpdfdoc/cpdf_nametree.cpp24
-rw-r--r--core/fpdfdoc/cpdf_numbertree.cpp6
-rw-r--r--core/fpdfdoc/cpdf_occontext.cpp44
-rw-r--r--core/fpdfdoc/cpdf_pagelabel.cpp8
-rw-r--r--core/fpdfdoc/cpdf_viewerpreferences.cpp12
-rw-r--r--core/fpdfdoc/cpvt_fontmap.cpp6
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp199
-rw-r--r--core/fpdfdoc/doc_tagged.cpp62
-rw-r--r--core/fpdfdoc/include/cpdf_action.h6
-rw-r--r--core/fpdfdoc/include/cpdf_formcontrol.h2
28 files changed, 434 insertions, 433 deletions
diff --git a/core/fpdfdoc/cpdf_aaction.cpp b/core/fpdfdoc/cpdf_aaction.cpp
index c2d77cf083..588c4c38df 100644
--- a/core/fpdfdoc/cpdf_aaction.cpp
+++ b/core/fpdfdoc/cpdf_aaction.cpp
@@ -19,6 +19,6 @@ FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const {
}
CPDF_Action CPDF_AAction::GetAction(AActionType eType) const {
- return m_pDict ? CPDF_Action(m_pDict->GetDictBy(g_sAATypes[eType]))
+ return m_pDict ? CPDF_Action(m_pDict->GetDictFor(g_sAATypes[eType]))
: CPDF_Action();
}
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index 86fc20ef2f..0255392cf7 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -25,11 +25,11 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
if (!m_pDict)
return CPDF_Dest();
- CFX_ByteString type = m_pDict->GetStringBy("S");
+ CFX_ByteString type = m_pDict->GetStringFor("S");
if (type != "GoTo" && type != "GoToR")
return CPDF_Dest();
- CPDF_Object* pDest = m_pDict->GetDirectObjectBy("D");
+ CPDF_Object* pDest = m_pDict->GetDirectObjectFor("D");
if (!pDest)
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
@@ -46,7 +46,7 @@ CPDF_Action::ActionType CPDF_Action::GetType() const {
if (!m_pDict)
return Unknown;
- CFX_ByteString csType = m_pDict->GetStringBy("S");
+ CFX_ByteString csType = m_pDict->GetStringFor("S");
if (csType.IsEmpty())
return Unknown;
@@ -58,20 +58,20 @@ CPDF_Action::ActionType CPDF_Action::GetType() const {
}
CFX_WideString CPDF_Action::GetFilePath() const {
- CFX_ByteString type = m_pDict->GetStringBy("S");
+ CFX_ByteString type = m_pDict->GetStringFor("S");
if (type != "GoToR" && type != "Launch" && type != "SubmitForm" &&
type != "ImportData") {
return CFX_WideString();
}
- CPDF_Object* pFile = m_pDict->GetDirectObjectBy("F");
+ CPDF_Object* pFile = m_pDict->GetDirectObjectFor("F");
CFX_WideString path;
if (!pFile) {
if (type == "Launch") {
- CPDF_Dictionary* pWinDict = m_pDict->GetDictBy("Win");
+ CPDF_Dictionary* pWinDict = m_pDict->GetDictFor("Win");
if (pWinDict) {
return CFX_WideString::FromLocal(
- pWinDict->GetStringBy("F").AsStringC());
+ pWinDict->GetStringFor("F").AsStringC());
}
}
return path;
@@ -86,15 +86,15 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
CFX_ByteString csURI;
if (!m_pDict)
return csURI;
- if (m_pDict->GetStringBy("S") != "URI")
+ if (m_pDict->GetStringFor("S") != "URI")
return csURI;
- csURI = m_pDict->GetStringBy("URI");
+ csURI = m_pDict->GetStringFor("URI");
CPDF_Dictionary* pRoot = pDoc->GetRoot();
- CPDF_Dictionary* pURI = pRoot->GetDictBy("URI");
+ CPDF_Dictionary* pURI = pRoot->GetDictFor("URI");
if (pURI) {
if (csURI.Find(":", 0) < 1)
- csURI = pURI->GetStringBy("Base") + csURI;
+ csURI = pURI->GetStringFor("Base") + csURI;
}
return csURI;
}
@@ -104,7 +104,7 @@ CFX_WideString CPDF_Action::GetJavaScript() const {
if (!m_pDict)
return csJS;
- CPDF_Object* pJS = m_pDict->GetDirectObjectBy("JS");
+ CPDF_Object* pJS = m_pDict->GetDirectObjectFor("JS");
return pJS ? pJS->GetUnicodeText() : csJS;
}
@@ -112,7 +112,7 @@ size_t CPDF_Action::GetSubActionsCount() const {
if (!m_pDict || !m_pDict->KeyExist("Next"))
return 0;
- CPDF_Object* pNext = m_pDict->GetDirectObjectBy("Next");
+ CPDF_Object* pNext = m_pDict->GetDirectObjectFor("Next");
if (!pNext)
return 0;
if (pNext->IsDictionary())
@@ -126,7 +126,7 @@ CPDF_Action CPDF_Action::GetSubAction(size_t iIndex) const {
if (!m_pDict || !m_pDict->KeyExist("Next"))
return CPDF_Action();
- CPDF_Object* pNext = m_pDict->GetDirectObjectBy("Next");
+ CPDF_Object* pNext = m_pDict->GetDirectObjectFor("Next");
if (CPDF_Dictionary* pDict = ToDictionary(pNext)) {
if (iIndex == 0)
return CPDF_Action(pDict);
diff --git a/core/fpdfdoc/cpdf_actionfields.cpp b/core/fpdfdoc/cpdf_actionfields.cpp
index 1ad1eb4673..438c67c7e8 100644
--- a/core/fpdfdoc/cpdf_actionfields.cpp
+++ b/core/fpdfdoc/cpdf_actionfields.cpp
@@ -18,12 +18,12 @@ size_t CPDF_ActionFields::GetFieldsCount() const {
if (!pDict)
return 0;
- CFX_ByteString csType = pDict->GetStringBy("S");
+ CFX_ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
- pFields = pDict->GetDirectObjectBy("T");
+ pFields = pDict->GetDirectObjectFor("T");
else
- pFields = pDict->GetArrayBy("Fields");
+ pFields = pDict->GetArrayFor("Fields");
if (!pFields)
return 0;
@@ -45,12 +45,12 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
if (!pDict)
return fields;
- CFX_ByteString csType = pDict->GetStringBy("S");
+ CFX_ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields;
if (csType == "Hide")
- pFields = pDict->GetDirectObjectBy("T");
+ pFields = pDict->GetDirectObjectFor("T");
else
- pFields = pDict->GetArrayBy("Fields");
+ pFields = pDict->GetArrayFor("Fields");
if (!pFields)
return fields;
@@ -75,12 +75,12 @@ CPDF_Object* CPDF_ActionFields::GetField(size_t iIndex) const {
if (!pDict)
return nullptr;
- CFX_ByteString csType = pDict->GetStringBy("S");
+ CFX_ByteString csType = pDict->GetStringFor("S");
CPDF_Object* pFields = nullptr;
if (csType == "Hide")
- pFields = pDict->GetDirectObjectBy("T");
+ pFields = pDict->GetDirectObjectFor("T");
else
- pFields = pDict->GetArrayBy("Fields");
+ pFields = pDict->GetArrayFor("Fields");
if (!pFields)
return nullptr;
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 0cc3596a4d..bee96a62ff 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -39,7 +39,7 @@ CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict,
m_pDocument(pDocument),
m_bOpenState(false),
m_pPopupAnnot(nullptr) {
- m_nSubtype = StringToAnnotSubtype(m_pAnnotDict->GetStringBy("Subtype"));
+ m_nSubtype = StringToAnnotSubtype(m_pAnnotDict->GetStringFor("Subtype"));
GenerateAPIfNeeded();
}
@@ -95,18 +95,18 @@ CFX_FloatRect CPDF_Annot::GetRect() const {
if (!m_pAnnotDict)
return CFX_FloatRect();
- CFX_FloatRect rect = m_pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = m_pAnnotDict->GetRectFor("Rect");
rect.Normalize();
return rect;
}
uint32_t CPDF_Annot::GetFlags() const {
- return m_pAnnotDict->GetIntegerBy("F");
+ return m_pAnnotDict->GetIntegerFor("F");
}
CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
CPDF_Annot::AppearanceMode mode) {
- CPDF_Dictionary* pAP = pAnnotDict->GetDictBy("AP");
+ CPDF_Dictionary* pAP = pAnnotDict->GetDictFor("AP");
if (!pAP) {
return nullptr;
}
@@ -118,26 +118,26 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
if (!pAP->KeyExist(ap_entry))
ap_entry = "N";
- CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry);
+ CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry);
if (!psub)
return nullptr;
if (CPDF_Stream* pStream = psub->AsStream())
return pStream;
if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
- CFX_ByteString as = pAnnotDict->GetStringBy("AS");
+ CFX_ByteString as = pAnnotDict->GetStringFor("AS");
if (as.IsEmpty()) {
- CFX_ByteString value = pAnnotDict->GetStringBy("V");
+ CFX_ByteString value = pAnnotDict->GetStringFor("V");
if (value.IsEmpty()) {
- CPDF_Dictionary* pParentDict = pAnnotDict->GetDictBy("Parent");
- value = pParentDict ? pParentDict->GetStringBy("V") : CFX_ByteString();
+ CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent");
+ value = pParentDict ? pParentDict->GetStringFor("V") : CFX_ByteString();
}
if (value.IsEmpty() || !pDict->KeyExist(value))
as = "Off";
else
as = value;
}
- return pDict->GetStreamBy(as);
+ return pDict->GetStreamFor(as);
}
return nullptr;
}
@@ -167,8 +167,8 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
if (!pForm) {
return nullptr;
}
- CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox");
- CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix");
+ CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectFor("BBox");
+ CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixFor("Matrix");
form_matrix.TransformRect(form_bbox);
matrix.MatchRect(pAnnot->GetRect(), form_bbox);
matrix.Concat(*pUser2Device);
@@ -177,7 +177,7 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
// Static.
bool CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) {
- return !!(pAnnotDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN);
+ return !!(pAnnotDict->GetIntegerFor("F") & ANNOTFLAG_HIDDEN);
}
// Static.
@@ -366,12 +366,12 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) {
return;
}
- CPDF_Dictionary* pBS = m_pAnnotDict->GetDictBy("BS");
+ CPDF_Dictionary* pBS = m_pAnnotDict->GetDictFor("BS");
char style_char;
FX_FLOAT width;
CPDF_Array* pDashArray = nullptr;
if (!pBS) {
- CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayBy("Border");
+ CPDF_Array* pBorderArray = m_pAnnotDict->GetArrayFor("Border");
style_char = 'S';
if (pBorderArray) {
width = pBorderArray->GetNumberAt(2);
@@ -397,15 +397,15 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
width = 1;
}
} else {
- CFX_ByteString style = pBS->GetStringBy("S");
- pDashArray = pBS->GetArrayBy("D");
+ CFX_ByteString style = pBS->GetStringFor("S");
+ pDashArray = pBS->GetArrayFor("D");
style_char = style[1];
- width = pBS->GetNumberBy("W");
+ width = pBS->GetNumberFor("W");
}
if (width <= 0) {
return;
}
- CPDF_Array* pColor = m_pAnnotDict->GetArrayBy("C");
+ CPDF_Array* pColor = m_pAnnotDict->GetArrayFor("C");
uint32_t argb = 0xff000000;
if (pColor) {
int R = (int32_t)(pColor->GetNumberAt(0) * 255);
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 31c8542daa..8ab99e55d2 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -26,23 +26,23 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot,
// TODO(jaepark): We shouldn't strip BOM for some strings and not for others.
// See pdfium:593.
- CFX_WideString sContents = pParentDict->GetUnicodeTextBy("Contents");
+ CFX_WideString sContents = pParentDict->GetUnicodeTextFor("Contents");
if (sContents.IsEmpty())
return std::unique_ptr<CPDF_Annot>();
CPDF_Dictionary* pAnnotDict = new CPDF_Dictionary;
- pAnnotDict->SetAtName("Type", "Annot");
- pAnnotDict->SetAtName("Subtype", "Popup");
- pAnnotDict->SetAtString("T", pParentDict->GetStringBy("T"));
- pAnnotDict->SetAtString("Contents", sContents.UTF8Encode());
+ pAnnotDict->SetNameFor("Type", "Annot");
+ pAnnotDict->SetNameFor("Subtype", "Popup");
+ pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T"));
+ pAnnotDict->SetStringFor("Contents", sContents.UTF8Encode());
- CFX_FloatRect rect = pParentDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pParentDict->GetRectFor("Rect");
rect.Normalize();
CFX_FloatRect popupRect(0, 0, 200, 200);
popupRect.Translate(rect.left, rect.bottom - popupRect.Height());
- pAnnotDict->SetAtRect("Rect", popupRect);
- pAnnotDict->SetAtInteger("F", 0);
+ pAnnotDict->SetRectFor("Rect", popupRect);
+ pAnnotDict->SetIntegerFor("F", 0);
std::unique_ptr<CPDF_Annot> pPopupAnnot(
new CPDF_Annot(pAnnotDict, pDocument, true));
@@ -57,14 +57,14 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
if (!pPage->m_pFormDict)
return;
- CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots");
+ CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots");
if (!pAnnots)
return;
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
- CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
+ CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm");
FX_BOOL bRegenerateAP =
- pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances");
+ pAcroForm && pAcroForm->GetBooleanFor("NeedAppearances");
for (size_t i = 0; i < pAnnots->GetCount(); ++i) {
CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i));
if (!pDict)
@@ -81,12 +81,12 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
// Skip creating Popup annotation in the PDF document since PDFium provides
// its own Popup annotations.
- if (pDict->GetStringBy("Subtype") == "Popup")
+ if (pDict->GetStringFor("Subtype") == "Popup")
continue;
m_AnnotList.push_back(
std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument, false)));
- if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" &&
+ if (bRegenerateAP && pDict->GetStringFor("Subtype") == "Widget" &&
CPDF_InterForm::IsUpdateAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);
}
@@ -130,7 +130,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
CPDF_OCContext* pOCContext = pOptions->m_pOCContext;
CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
if (pOCContext && pAnnotDict &&
- !pOCContext->CheckOCGVisible(pAnnotDict->GetDictBy("OC"))) {
+ !pOCContext->CheckOCGVisible(pAnnotDict->GetDictFor("OC"))) {
continue;
}
}
diff --git a/core/fpdfdoc/cpdf_apsettings.cpp b/core/fpdfdoc/cpdf_apsettings.cpp
index f2a802b445..3715e8ab89 100644
--- a/core/fpdfdoc/cpdf_apsettings.cpp
+++ b/core/fpdfdoc/cpdf_apsettings.cpp
@@ -17,7 +17,7 @@ bool CPDF_ApSettings::HasMKEntry(const CFX_ByteString& csEntry) const {
}
int CPDF_ApSettings::GetRotation() const {
- return m_pDict ? m_pDict->GetIntegerBy("R") : 0;
+ return m_pDict ? m_pDict->GetIntegerFor("R") : 0;
}
FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
@@ -26,7 +26,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
if (!m_pDict)
return 0;
- CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry);
+ CPDF_Array* pEntry = m_pDict->GetArrayFor(csEntry);
if (!pEntry)
return 0;
@@ -64,7 +64,7 @@ FX_FLOAT CPDF_ApSettings::GetOriginalColor(
if (!m_pDict)
return 0;
- CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry);
+ CPDF_Array* pEntry = m_pDict->GetArrayFor(csEntry);
return pEntry ? pEntry->GetNumberAt(index) : 0;
}
@@ -78,7 +78,7 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType,
if (!m_pDict)
return;
- CPDF_Array* pEntry = m_pDict->GetArrayBy(csEntry);
+ CPDF_Array* pEntry = m_pDict->GetArrayFor(csEntry);
if (!pEntry)
return;
@@ -102,18 +102,18 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType,
CFX_WideString CPDF_ApSettings::GetCaption(
const CFX_ByteString& csEntry) const {
- return m_pDict ? m_pDict->GetUnicodeTextBy(csEntry) : CFX_WideString();
+ return m_pDict ? m_pDict->GetUnicodeTextFor(csEntry) : CFX_WideString();
}
CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteString& csEntry) const {
- return m_pDict ? m_pDict->GetStreamBy(csEntry) : nullptr;
+ return m_pDict ? m_pDict->GetStreamFor(csEntry) : nullptr;
}
CPDF_IconFit CPDF_ApSettings::GetIconFit() const {
- return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr);
+ return CPDF_IconFit(m_pDict ? m_pDict->GetDictFor("IF") : nullptr);
}
int CPDF_ApSettings::GetTextPosition() const {
- return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION)
+ return m_pDict ? m_pDict->GetIntegerFor("TP", TEXTPOS_CAPTION)
: TEXTPOS_CAPTION;
}
diff --git a/core/fpdfdoc/cpdf_bookmark.cpp b/core/fpdfdoc/cpdf_bookmark.cpp
index c9a2199750..de9832d233 100644
--- a/core/fpdfdoc/cpdf_bookmark.cpp
+++ b/core/fpdfdoc/cpdf_bookmark.cpp
@@ -15,7 +15,7 @@ uint32_t CPDF_Bookmark::GetColorRef() const {
if (!m_pDict)
return FXSYS_RGB(0, 0, 0);
- CPDF_Array* pColor = m_pDict->GetArrayBy("C");
+ CPDF_Array* pColor = m_pDict->GetArrayFor("C");
if (!pColor)
return FXSYS_RGB(0, 0, 0);
@@ -26,14 +26,14 @@ uint32_t CPDF_Bookmark::GetColorRef() const {
}
uint32_t CPDF_Bookmark::GetFontStyle() const {
- return m_pDict ? m_pDict->GetIntegerBy("F") : 0;
+ return m_pDict ? m_pDict->GetIntegerFor("F") : 0;
}
CFX_WideString CPDF_Bookmark::GetTitle() const {
if (!m_pDict)
return CFX_WideString();
- CPDF_String* pString = ToString(m_pDict->GetDirectObjectBy("Title"));
+ CPDF_String* pString = ToString(m_pDict->GetDirectObjectFor("Title"));
if (!pString)
return CFX_WideString();
@@ -54,7 +54,7 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
if (!m_pDict)
return CPDF_Dest();
- CPDF_Object* pDest = m_pDict->GetDirectObjectBy("Dest");
+ CPDF_Object* pDest = m_pDict->GetDirectObjectFor("Dest");
if (!pDest)
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
@@ -67,5 +67,5 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
}
CPDF_Action CPDF_Bookmark::GetAction() const {
- return m_pDict ? CPDF_Action(m_pDict->GetDictBy("A")) : CPDF_Action();
+ return m_pDict ? CPDF_Action(m_pDict->GetDictFor("A")) : CPDF_Action();
}
diff --git a/core/fpdfdoc/cpdf_bookmarktree.cpp b/core/fpdfdoc/cpdf_bookmarktree.cpp
index 5ebb317a06..c10fabb240 100644
--- a/core/fpdfdoc/cpdf_bookmarktree.cpp
+++ b/core/fpdfdoc/cpdf_bookmarktree.cpp
@@ -12,14 +12,14 @@ CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild(
const CPDF_Bookmark& parent) const {
CPDF_Dictionary* pParentDict = parent.GetDict();
if (pParentDict)
- return CPDF_Bookmark(pParentDict->GetDictBy("First"));
+ return CPDF_Bookmark(pParentDict->GetDictFor("First"));
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
if (!pRoot)
return CPDF_Bookmark();
- CPDF_Dictionary* pOutlines = pRoot->GetDictBy("Outlines");
- return pOutlines ? CPDF_Bookmark(pOutlines->GetDictBy("First"))
+ CPDF_Dictionary* pOutlines = pRoot->GetDictFor("Outlines");
+ return pOutlines ? CPDF_Bookmark(pOutlines->GetDictFor("First"))
: CPDF_Bookmark();
}
@@ -29,6 +29,6 @@ CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling(
if (!pDict)
return CPDF_Bookmark();
- CPDF_Dictionary* pNext = pDict->GetDictBy("Next");
+ CPDF_Dictionary* pNext = pDict->GetDictFor("Next");
return pNext == pDict ? CPDF_Bookmark() : CPDF_Bookmark(pNext);
}
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index 2084606629..3176eb51af 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -80,23 +80,23 @@ CFX_WideString CPDF_FileSpec::DecodeFileName(const CFX_WideStringC& filepath) {
bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const {
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- *csFileName = pDict->GetUnicodeTextBy("UF");
+ *csFileName = pDict->GetUnicodeTextFor("UF");
if (csFileName->IsEmpty()) {
*csFileName =
- CFX_WideString::FromLocal(pDict->GetStringBy("F").AsStringC());
+ CFX_WideString::FromLocal(pDict->GetStringFor("F").AsStringC());
}
- if (pDict->GetStringBy("FS") == "URL")
+ if (pDict->GetStringFor("FS") == "URL")
return true;
if (csFileName->IsEmpty()) {
if (pDict->KeyExist("DOS")) {
*csFileName =
- CFX_WideString::FromLocal(pDict->GetStringBy("DOS").AsStringC());
+ CFX_WideString::FromLocal(pDict->GetStringFor("DOS").AsStringC());
} else if (pDict->KeyExist("Mac")) {
*csFileName =
- CFX_WideString::FromLocal(pDict->GetStringBy("Mac").AsStringC());
+ CFX_WideString::FromLocal(pDict->GetStringFor("Mac").AsStringC());
} else if (pDict->KeyExist("Unix")) {
*csFileName =
- CFX_WideString::FromLocal(pDict->GetStringBy("Unix").AsStringC());
+ CFX_WideString::FromLocal(pDict->GetStringFor("Unix").AsStringC());
} else {
return false;
}
@@ -112,7 +112,7 @@ bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const {
CPDF_FileSpec::CPDF_FileSpec() {
m_pObj = new CPDF_Dictionary;
- m_pObj->AsDictionary()->SetAtName("Type", "Filespec");
+ m_pObj->AsDictionary()->SetNameFor("Type", "Filespec");
}
CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideStringC& filepath) {
@@ -161,7 +161,7 @@ void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName) {
if (m_pObj->IsString()) {
m_pObj->SetString(CFX_ByteString::FromUnicode(wsStr));
} else if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- pDict->SetAtString("F", CFX_ByteString::FromUnicode(wsStr));
- pDict->SetAtString("UF", PDF_EncodeText(wsStr));
+ pDict->SetStringFor("F", CFX_ByteString::FromUnicode(wsStr));
+ pDict->SetStringFor("UF", PDF_EncodeText(wsStr));
}
}
diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp
index 0843f3045b..f63c388478 100644
--- a/core/fpdfdoc/cpdf_filespec_unittest.cpp
+++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp
@@ -109,13 +109,13 @@ TEST(cpdf_filespec, GetFileName) {
CPDF_FileSpec file_spec(dict_obj.get());
CFX_WideString file_name;
for (int i = 0; i < 5; ++i) {
- dict_obj->SetAt(keywords[i], new CPDF_String(test_data[i].input));
+ dict_obj->SetFor(keywords[i], new CPDF_String(test_data[i].input));
EXPECT_TRUE(file_spec.GetFileName(&file_name));
EXPECT_TRUE(file_name == test_data[i].expected);
}
// With all the former fields and 'FS' field suggests 'URL' type.
- dict_obj->SetAtString("FS", "URL");
+ dict_obj->SetStringFor("FS", "URL");
EXPECT_TRUE(file_spec.GetFileName(&file_name));
// Url string is not decoded.
EXPECT_TRUE(file_name == test_data[4].input);
@@ -159,9 +159,9 @@ TEST(cpdf_filespec, SetFileName) {
CPDF_FileSpec file_spec2(dict_obj.get());
file_spec2.SetFileName(test_data.input);
// Check internal object value.
- file_name = dict_obj->GetUnicodeTextBy("F");
+ file_name = dict_obj->GetUnicodeTextFor("F");
EXPECT_TRUE(file_name == test_data.expected);
- file_name = dict_obj->GetUnicodeTextBy("UF");
+ file_name = dict_obj->GetUnicodeTextFor("UF");
EXPECT_TRUE(file_name == test_data.expected);
// Check we can get the file name back.
EXPECT_TRUE(file_spec2.GetFileName(&file_name));
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 9d134842fa..c633d0c187 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -35,11 +35,11 @@ CFX_ByteString CPDF_FormControl::GetOnStateName() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn;
- CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP");
+ CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
if (!pAP)
return csOn;
- CPDF_Dictionary* pN = pAP->GetDictBy("N");
+ CPDF_Dictionary* pN = pAP->GetDictFor("N");
if (!pN)
return csOn;
@@ -59,11 +59,11 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
else if (csValue == "Off")
csValue = "Yes";
- CFX_ByteString csAS = m_pWidgetDict->GetStringBy("AS", "Off");
+ CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS", "Off");
if (csAS != "Off")
- m_pWidgetDict->SetAtName("AS", csValue);
+ m_pWidgetDict->SetNameFor("AS", csValue);
- CPDF_Dictionary* pAP = m_pWidgetDict->GetDictBy("AP");
+ CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
if (!pAP)
return;
@@ -129,7 +129,7 @@ bool CPDF_FormControl::IsChecked() const {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn = GetOnStateName();
- CFX_ByteString csAS = m_pWidgetDict->GetStringBy("AS");
+ CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS");
return csAS == csOn;
}
@@ -149,13 +149,13 @@ 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->GetStringBy("AS", "Off");
+ CFX_ByteString csOldAS = m_pWidgetDict->GetStringFor("AS", "Off");
CFX_ByteString csAS = "Off";
if (bChecked)
csAS = csOn;
if (csOldAS == csAS)
return;
- m_pWidgetDict->SetAtName("AS", csAS);
+ m_pWidgetDict->SetNameFor("AS", csAS);
}
void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
@@ -163,22 +163,22 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
CPDF_Page* pPage,
CPDF_Annot::AppearanceMode mode,
const CPDF_RenderOptions* pOptions) {
- if (m_pWidgetDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN)
+ if (m_pWidgetDict->GetIntegerFor("F") & ANNOTFLAG_HIDDEN)
return;
CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode);
if (!pStream)
return;
- CFX_FloatRect form_bbox = pStream->GetDict()->GetRectBy("BBox");
- CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixBy("Matrix");
+ CFX_FloatRect form_bbox = pStream->GetDict()->GetRectFor("BBox");
+ CFX_Matrix form_matrix = pStream->GetDict()->GetMatrixFor("Matrix");
form_matrix.TransformRect(form_bbox);
- CFX_FloatRect arect = m_pWidgetDict->GetRectBy("Rect");
+ CFX_FloatRect arect = m_pWidgetDict->GetRectFor("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->GetDictBy("DR"), pStream);
+ m_pField->m_pForm->m_pFormDict->GetDictFor("DR"), pStream);
form.ParseContent(nullptr, nullptr, nullptr);
CPDF_RenderContext context(pPage);
context.AppendLayer(&form, &matrix);
@@ -189,7 +189,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() {
if (!m_pWidgetDict)
return Invert;
- CFX_ByteString csH = m_pWidgetDict->GetStringBy("H", "I");
+ CFX_ByteString csH = m_pWidgetDict->GetStringFor("H", "I");
for (size_t i = 0; i < FX_ArraySize(g_sHighlightingMode); ++i) {
if (csH == g_sHighlightingMode[i])
return static_cast<HighlightingMode>(i);
@@ -198,7 +198,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() {
}
CPDF_ApSettings CPDF_FormControl::GetMK() const {
- return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDictBy("MK")
+ return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDictFor("MK")
: nullptr);
}
@@ -247,7 +247,7 @@ CPDF_Action CPDF_FormControl::GetAction() {
return CPDF_Action();
if (m_pWidgetDict->KeyExist("A"))
- return CPDF_Action(m_pWidgetDict->GetDictBy("A"));
+ return CPDF_Action(m_pWidgetDict->GetDictFor("A"));
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A");
if (!pObj)
@@ -261,7 +261,7 @@ CPDF_AAction CPDF_FormControl::GetAdditionalAction() {
return CPDF_AAction();
if (m_pWidgetDict->KeyExist("AA"))
- return CPDF_AAction(m_pWidgetDict->GetDictBy("AA"));
+ return CPDF_AAction(m_pWidgetDict->GetDictFor("AA"));
return m_pField->GetAdditionalAction();
}
@@ -270,7 +270,7 @@ CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() {
return CPDF_DefaultAppearance();
if (m_pWidgetDict->KeyExist("DA"))
- return CPDF_DefaultAppearance(m_pWidgetDict->GetStringBy("DA"));
+ return CPDF_DefaultAppearance(m_pWidgetDict->GetStringFor("DA"));
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "DA");
if (pObj)
@@ -288,9 +288,9 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR");
if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
- CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDict->GetDictFor("Font");
if (pFonts) {
- CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag);
+ CPDF_Dictionary* pElement = pFonts->GetDictFor(csFontNameTag);
if (pElement) {
CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont)
@@ -301,12 +301,12 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag))
return pFormFont;
- CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictBy("P");
+ CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictFor("P");
pObj = FPDF_GetFieldAttr(pPageDict, "Resources");
if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
- CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDict->GetDictFor("Font");
if (pFonts) {
- CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag);
+ CPDF_Dictionary* pElement = pFonts->GetDictFor(csFontNameTag);
if (pElement) {
CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont)
@@ -321,7 +321,7 @@ int CPDF_FormControl::GetControlAlignment() {
if (!m_pWidgetDict)
return 0;
if (m_pWidgetDict->KeyExist("Q"))
- return m_pWidgetDict->GetIntegerBy("Q", 0);
+ return m_pWidgetDict->GetIntegerFor("Q", 0);
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q");
if (pObj)
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 8d7d0b4dc0..cbce1aaf69 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -56,11 +56,11 @@ CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict,
if (!pFieldDict)
return nullptr;
- CPDF_Object* pAttr = pFieldDict->GetDirectObjectBy(name);
+ CPDF_Object* pAttr = pFieldDict->GetDirectObjectFor(name);
if (pAttr)
return pAttr;
- CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent");
+ CPDF_Dictionary* pParent = pFieldDict->GetDictFor("Parent");
if (!pParent)
return nullptr;
return FPDF_GetFieldAttr(pParent, name, nLevel + 1);
@@ -72,14 +72,14 @@ CFX_WideString FPDF_GetFullName(CPDF_Dictionary* pFieldDict) {
CPDF_Dictionary* pLevel = pFieldDict;
while (pLevel) {
visited.insert(pLevel);
- CFX_WideString short_name = pLevel->GetUnicodeTextBy("T");
+ CFX_WideString short_name = pLevel->GetUnicodeTextFor("T");
if (!short_name.IsEmpty()) {
if (full_name.IsEmpty())
full_name = short_name;
else
full_name = short_name + L"." + full_name;
}
- pLevel = pLevel->GetDictBy("Parent");
+ pLevel = pLevel->GetDictFor("Parent");
if (pdfium::ContainsKey(visited, pLevel))
break;
}
@@ -223,14 +223,14 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
if (!pClone)
return FALSE;
- m_pDict->SetAt("V", pClone);
+ m_pDict->SetFor("V", pClone);
if (pRV) {
CPDF_Object* pCloneR = pDV->Clone();
- m_pDict->SetAt("RV", pCloneR);
+ m_pDict->SetFor("RV", pCloneR);
}
} else {
- m_pDict->RemoveAt("V");
- m_pDict->RemoveAt("RV");
+ m_pDict->RemoveFor("V");
+ m_pDict->RemoveFor("RV");
}
if (bNotify)
NotifyAfterValueChange();
@@ -364,12 +364,12 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
int iIndex = FindOptionValue(csValue);
if (iIndex < 0) {
CFX_ByteString bsEncodeText = PDF_EncodeText(csValue);
- m_pDict->SetAtString(bDefault ? "DV" : "V", bsEncodeText);
+ m_pDict->SetStringFor(bDefault ? "DV" : "V", bsEncodeText);
if (m_Type == RichText && !bDefault)
- m_pDict->SetAtString("RV", bsEncodeText);
- m_pDict->RemoveAt("I");
+ m_pDict->SetStringFor("RV", bsEncodeText);
+ m_pDict->RemoveFor("I");
} else {
- m_pDict->SetAtString(bDefault ? "DV" : "V", PDF_EncodeText(csValue));
+ m_pDict->SetStringFor(bDefault ? "DV" : "V", PDF_EncodeText(csValue));
if (!bDefault) {
ClearSelection();
SetItemSelection(iIndex, TRUE);
@@ -419,7 +419,7 @@ int CPDF_FormField::GetMaxLen() const {
CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict;
if (pWidgetDict->KeyExist("MaxLen"))
- return pWidgetDict->GetIntegerBy("MaxLen");
+ return pWidgetDict->GetIntegerFor("MaxLen");
}
return 0;
}
@@ -486,8 +486,8 @@ FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) {
if (!NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
}
- m_pDict->RemoveAt("V");
- m_pDict->RemoveAt("I");
+ m_pDict->RemoveFor("V");
+ m_pDict->RemoveFor("I");
if (bNotify)
NotifyListOrComboBoxAfterChange();
return TRUE;
@@ -551,7 +551,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
if (GetType() == ListBox) {
SelectOption(index, TRUE);
if (!(m_Flags & kFormListMultiSelect)) {
- m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
+ m_pDict->SetStringFor("V", PDF_EncodeText(opt_value));
} else {
CPDF_Array* pArray = new CPDF_Array;
for (int i = 0; i < CountOptions(); i++) {
@@ -560,13 +560,13 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
pArray->AddString(PDF_EncodeText(opt_value));
}
}
- m_pDict->SetAt("V", pArray);
+ m_pDict->SetFor("V", pArray);
}
} else {
- m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
+ m_pDict->SetStringFor("V", PDF_EncodeText(opt_value));
CPDF_Array* pI = new CPDF_Array;
pI->AddInteger(index);
- m_pDict->SetAt("I", pI);
+ m_pDict->SetFor("I", pI);
}
} else {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
@@ -575,7 +575,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
SelectOption(index, FALSE);
if (pValue->IsString()) {
if (pValue->GetUnicodeText() == opt_value)
- m_pDict->RemoveAt("V");
+ m_pDict->RemoveFor("V");
} else if (pValue->IsArray()) {
CPDF_Array* pArray = new CPDF_Array;
for (int i = 0; i < CountOptions(); i++) {
@@ -587,11 +587,11 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
if (pArray->GetCount() < 1)
pArray->Release();
else
- m_pDict->SetAt("V", pArray);
+ m_pDict->SetFor("V", pArray);
}
} else {
- m_pDict->RemoveAt("V");
- m_pDict->RemoveAt("I");
+ m_pDict->RemoveFor("V");
+ m_pDict->RemoveFor("I");
}
}
}
@@ -683,7 +683,7 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
CPDF_Array* pOpt = ToArray(pValue);
if (!pOpt) {
pOpt = new CPDF_Array;
- m_pDict->SetAt("Opt", pOpt);
+ m_pDict->SetFor("Opt", pOpt);
}
int iCount = pdfium::base::checked_cast<int, size_t>(pOpt->GetCount());
@@ -710,11 +710,11 @@ FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
return FALSE;
}
- m_pDict->RemoveAt("Opt");
- m_pDict->RemoveAt("V");
- m_pDict->RemoveAt("DV");
- m_pDict->RemoveAt("I");
- m_pDict->RemoveAt("TI");
+ m_pDict->RemoveFor("Opt");
+ m_pDict->RemoveFor("V");
+ m_pDict->RemoveFor("DV");
+ m_pDict->RemoveFor("I");
+ m_pDict->RemoveFor("TI");
if (bNotify)
NotifyListOrComboBoxAfterChange();
@@ -760,19 +760,19 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pDict, "Opt");
if (!ToArray(pOpt)) {
if (bChecked) {
- m_pDict->SetAtName("V", csBExport);
+ m_pDict->SetNameFor("V", csBExport);
} else {
CFX_ByteString csV;
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
if (pV)
csV = pV->GetString();
if (csV == csBExport)
- m_pDict->SetAtName("V", "Off");
+ m_pDict->SetNameFor("V", "Off");
}
} else if (bChecked) {
CFX_ByteString csIndex;
csIndex.Format("%d", iControlIndex);
- m_pDict->SetAtName("V", csIndex);
+ m_pDict->SetNameFor("V", csIndex);
}
if (bNotify && m_pForm->m_pFormNotify)
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
@@ -850,13 +850,13 @@ FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) const {
FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
FX_BOOL bSelected,
FX_BOOL bNotify) {
- CPDF_Array* pArray = m_pDict->GetArrayBy("I");
+ CPDF_Array* pArray = m_pDict->GetArrayFor("I");
if (!pArray) {
if (!bSelected)
return TRUE;
pArray = new CPDF_Array;
- m_pDict->SetAt("I", pArray);
+ m_pDict->SetFor("I", pArray);
}
FX_BOOL bReturn = FALSE;
@@ -895,7 +895,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
pArray->AddInteger(iOptIndex);
if (pArray->IsEmpty())
- m_pDict->RemoveAt("I");
+ m_pDict->RemoveFor("I");
}
if (bNotify)
NotifyListOrComboBoxAfterChange();
@@ -913,7 +913,7 @@ FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) {
if (!NotifyListOrComboBoxBeforeChange(csValue))
return FALSE;
}
- m_pDict->RemoveAt("I");
+ m_pDict->RemoveFor("I");
if (bNotify)
NotifyListOrComboBoxAfterChange();
@@ -930,23 +930,23 @@ void CPDF_FormField::LoadDA() {
DA = pObj->GetString();
if (DA.IsEmpty())
- DA = pFormDict->GetStringBy("DA");
+ DA = pFormDict->GetStringFor("DA");
if (DA.IsEmpty())
return;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return;
- CPDF_Dictionary* pFont = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFont = pDR->GetDictFor("Font");
if (!pFont)
return;
CPDF_SimpleParser syntax(DA.AsStringC());
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString font_name(syntax.GetWord());
- CPDF_Dictionary* pFontDict = pFont->GetDictBy(font_name);
+ CPDF_Dictionary* pFontDict = pFont->GetDictFor(font_name);
if (!pFontDict)
return;
diff --git a/core/fpdfdoc/cpdf_formfield_unittest.cpp b/core/fpdfdoc/cpdf_formfield_unittest.cpp
index 33a21185cd..7677f45284 100644
--- a/core/fpdfdoc/cpdf_formfield_unittest.cpp
+++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp
@@ -14,31 +14,31 @@ TEST(cpdf_formfield, FPDF_GetFullName) {
CPDF_IndirectObjectHolder obj_holder;
CPDF_Dictionary* root = new CPDF_Dictionary;
obj_holder.AddIndirectObject(root);
- root->SetAtName("T", "foo");
+ root->SetNameFor("T", "foo");
name = FPDF_GetFullName(root);
EXPECT_STREQ("foo", name.UTF8Encode().c_str());
CPDF_Dictionary* dict1 = new CPDF_Dictionary;
obj_holder.AddIndirectObject(dict1);
- dict1->SetAtName("T", "bar");
- root->SetAtReference("Parent", &obj_holder, dict1);
+ dict1->SetNameFor("T", "bar");
+ root->SetReferenceFor("Parent", &obj_holder, dict1);
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
CPDF_Dictionary* dict2 = new CPDF_Dictionary;
obj_holder.AddIndirectObject(dict2);
- dict1->SetAt("Parent", dict2);
+ dict1->SetFor("Parent", dict2);
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
CPDF_Dictionary* dict3 = new CPDF_Dictionary;
obj_holder.AddIndirectObject(dict3);
- dict3->SetAtName("T", "qux");
- dict2->SetAtReference("Parent", &obj_holder, dict3);
+ dict3->SetNameFor("T", "qux");
+ dict2->SetReferenceFor("Parent", &obj_holder, dict3);
name = FPDF_GetFullName(root);
EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());
- dict3->SetAtReference("Parent", &obj_holder, root);
+ dict3->SetReferenceFor("Parent", &obj_holder, root);
name = FPDF_GetFullName(root);
EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());
name = FPDF_GetFullName(dict1);
diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp
index 3b3a09a54b..d86c4d918d 100644
--- a/core/fpdfdoc/cpdf_iconfit.cpp
+++ b/core/fpdfdoc/cpdf_iconfit.cpp
@@ -14,7 +14,7 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() {
if (!m_pDict)
return Always;
- CFX_ByteString csSW = m_pDict->GetStringBy("SW", "A");
+ CFX_ByteString csSW = m_pDict->GetStringFor("SW", "A");
if (csSW == "B")
return Bigger;
if (csSW == "S")
@@ -25,7 +25,7 @@ CPDF_IconFit::ScaleMethod CPDF_IconFit::GetScaleMethod() {
}
FX_BOOL CPDF_IconFit::IsProportionalScale() {
- return m_pDict ? m_pDict->GetStringBy("S", "P") != "A" : TRUE;
+ return m_pDict ? m_pDict->GetStringFor("S", "P") != "A" : TRUE;
}
void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
@@ -33,7 +33,7 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
if (!m_pDict)
return;
- CPDF_Array* pA = m_pDict->GetArrayBy("A");
+ CPDF_Array* pA = m_pDict->GetArrayFor("A");
if (pA) {
uint32_t dwCount = pA->GetCount();
if (dwCount > 0)
@@ -44,5 +44,5 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
}
bool CPDF_IconFit::GetFittingBounds() {
- return m_pDict ? m_pDict->GetBooleanBy("FB") : false;
+ return m_pDict ? m_pDict->GetBooleanFor("FB") : false;
}
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 0ebf4460cf..196eeccfba 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -36,7 +36,7 @@ const struct SupportFieldEncoding {
CFX_WideString GetFieldValue(const CPDF_Dictionary& pFieldDict,
const CFX_ByteString& bsEncoding) {
- const CFX_ByteString csBValue = pFieldDict.GetStringBy("V");
+ const CFX_ByteString csBValue = pFieldDict.GetStringFor("V");
for (const auto& encoding : g_fieldEncoding) {
if (bsEncoding == encoding.m_name)
return CFX_WideString::FromCodePage(csBValue.AsStringC(),
@@ -61,7 +61,7 @@ void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
pFormDict = new CPDF_Dictionary;
uint32_t dwObjNum = pDocument->AddIndirectObject(pFormDict);
CPDF_Dictionary* pRoot = pDocument->GetRoot();
- pRoot->SetAtReference("AcroForm", pDocument, dwObjNum);
+ pRoot->SetReferenceFor("AcroForm", pDocument, dwObjNum);
}
CFX_ByteString csDA;
@@ -94,18 +94,18 @@ void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
csDA += "0 g";
if (!pFormDict->KeyExist("DA"))
- pFormDict->SetAtString("DA", csDA);
+ pFormDict->SetStringFor("DA", csDA);
}
uint32_t CountFonts(CPDF_Dictionary* pFormDict) {
if (!pFormDict)
return 0;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return 0;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return 0;
@@ -116,7 +116,7 @@ uint32_t CountFonts(CPDF_Dictionary* pFormDict) {
continue;
if (CPDF_Dictionary* pDirect = ToDictionary(pObj->GetDirect())) {
- if (pDirect->GetStringBy("Type") == "Font")
+ if (pDirect->GetStringFor("Type") == "Font")
dwCount++;
}
}
@@ -130,11 +130,11 @@ CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
if (!pFormDict)
return nullptr;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return nullptr;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return nullptr;
@@ -148,7 +148,7 @@ CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
- if (pElement->GetStringBy("Type") != "Font")
+ if (pElement->GetStringFor("Type") != "Font")
continue;
if (dwCount == index) {
csNameTag = csKey;
@@ -166,19 +166,19 @@ CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
if (!pFormDict || csAlias.IsEmpty())
return nullptr;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return nullptr;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return nullptr;
- CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias);
+ CPDF_Dictionary* pElement = pFonts->GetDictFor(csAlias);
if (!pElement)
return nullptr;
- if (pElement->GetStringBy("Type") == "Font")
+ if (pElement->GetStringFor("Type") == "Font")
return pDocument->LoadFont(pElement);
return nullptr;
}
@@ -190,11 +190,11 @@ CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
if (!pFormDict || csFontName.IsEmpty())
return nullptr;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return nullptr;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return nullptr;
@@ -207,7 +207,7 @@ CPDF_Font* GetFont(CPDF_Dictionary* pFormDict,
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
- if (pElement->GetStringBy("Type") != "Font")
+ if (pElement->GetStringFor("Type") != "Font")
continue;
CPDF_Font* pFind = pDocument->LoadFont(pElement);
@@ -232,11 +232,11 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
if (!pFormDict)
return nullptr;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return nullptr;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return nullptr;
@@ -249,7 +249,7 @@ CPDF_Font* GetNativeFont(CPDF_Dictionary* pFormDict,
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
- if (pElement->GetStringBy("Type") != "Font")
+ if (pElement->GetStringFor("Type") != "Font")
continue;
CPDF_Font* pFind = pDocument->LoadFont(pElement);
if (!pFind)
@@ -272,7 +272,7 @@ CPDF_Font* GetDefaultFont(CPDF_Dictionary* pFormDict,
if (!pFormDict)
return nullptr;
- CPDF_DefaultAppearance cDA(pFormDict->GetStringBy("DA"));
+ CPDF_DefaultAppearance cDA(pFormDict->GetStringFor("DA"));
CFX_ByteString csFontNameTag;
FX_FLOAT fFontSize;
cDA.GetFont(csFontNameTag, fFontSize);
@@ -285,11 +285,11 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
if (!pFormDict || !pFont)
return FALSE;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return FALSE;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return FALSE;
@@ -302,7 +302,7 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
- if (pElement->GetStringBy("Type") != "Font")
+ if (pElement->GetStringFor("Type") != "Font")
continue;
if (pFont->GetFontDict() == pElement) {
csNameTag = csKey;
@@ -336,11 +336,11 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
if (!pFormDict)
return FALSE;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return FALSE;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return FALSE;
if (csFontName.GetLength() > 0)
@@ -355,7 +355,7 @@ FX_BOOL FindFont(CPDF_Dictionary* pFormDict,
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
if (!pElement)
continue;
- if (pElement->GetStringBy("Type") != "Font")
+ if (pElement->GetStringFor("Type") != "Font")
continue;
pFont = pDocument->LoadFont(pElement);
@@ -390,15 +390,15 @@ void AddFont(CPDF_Dictionary*& pFormDict,
if (!pFormDict)
InitDict(pFormDict, pDocument);
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR) {
pDR = new CPDF_Dictionary;
- pFormDict->SetAt("DR", pDR);
+ pFormDict->SetFor("DR", pDR);
}
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts) {
pFonts = new CPDF_Dictionary;
- pDR->SetAt("Font", pFonts);
+ pDR->SetFor("Font", pFonts);
}
if (csNameTag.IsEmpty())
csNameTag = pFont->GetBaseFont();
@@ -406,7 +406,7 @@ void AddFont(CPDF_Dictionary*& pFormDict,
csNameTag.Remove(' ');
csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4,
csNameTag.c_str());
- pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict());
+ pFonts->SetReferenceFor(csNameTag, pDocument, pFont->GetFontDict());
}
CPDF_Font* AddNativeFont(CPDF_Dictionary*& pFormDict,
@@ -442,24 +442,24 @@ void RemoveFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) {
if (!FindFont(pFormDict, pFont, csTag))
return;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
- pFonts->RemoveAt(csTag);
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
+ pFonts->RemoveFor(csTag);
}
void RemoveFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) {
if (!pFormDict || csNameTag.IsEmpty())
return;
- CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return;
- CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
+ CPDF_Dictionary* pFonts = pDR->GetDictFor("Font");
if (!pFonts)
return;
- pFonts->RemoveAt(csNameTag);
+ pFonts->RemoveFor(csNameTag);
}
class CFieldNameExtractor {
@@ -815,11 +815,11 @@ CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument)
if (!pRoot)
return;
- m_pFormDict = pRoot->GetDictBy("AcroForm");
+ m_pFormDict = pRoot->GetDictFor("AcroForm");
if (!m_pFormDict)
return;
- CPDF_Array* pFields = m_pFormDict->GetArrayBy("Fields");
+ CPDF_Array* pFields = m_pFormDict->GetArrayFor("Fields");
if (!pFields)
return;
@@ -880,7 +880,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
if (!pResDict)
return csTmp;
- CPDF_Dictionary* pDict = pResDict->GetDictBy(csType);
+ CPDF_Dictionary* pDict = pResDict->GetDictFor(csType);
if (!pDict)
return csTmp;
@@ -1131,7 +1131,7 @@ 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->GetArrayBy("Annots");
+ CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayFor("Annots");
if (!pAnnotList)
return nullptr;
@@ -1164,14 +1164,14 @@ CPDF_FormControl* CPDF_InterForm::GetControlByDict(
}
FX_BOOL CPDF_InterForm::NeedConstructAP() const {
- return m_pFormDict && m_pFormDict->GetBooleanBy("NeedAppearances");
+ return m_pFormDict && m_pFormDict->GetBooleanFor("NeedAppearances");
}
int CPDF_InterForm::CountFieldsInCalculationOrder() {
if (!m_pFormDict)
return 0;
- CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
+ CPDF_Array* pArray = m_pFormDict->GetArrayFor("CO");
return pArray ? pArray->GetCount() : 0;
}
@@ -1179,7 +1179,7 @@ CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) {
if (!m_pFormDict || index < 0)
return nullptr;
- CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
+ CPDF_Array* pArray = m_pFormDict->GetArrayFor("CO");
if (!pArray)
return nullptr;
@@ -1191,7 +1191,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
if (!m_pFormDict || !pField)
return -1;
- CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
+ CPDF_Array* pArray = m_pFormDict->GetArrayFor("CO");
if (!pArray)
return -1;
@@ -1266,7 +1266,7 @@ void CPDF_InterForm::RemoveFormFont(CFX_ByteString csNameTag) {
CPDF_DefaultAppearance CPDF_InterForm::GetDefaultAppearance() {
if (!m_pFormDict)
return CPDF_DefaultAppearance();
- return CPDF_DefaultAppearance(m_pFormDict->GetStringBy("DA"));
+ return CPDF_DefaultAppearance(m_pFormDict->GetStringFor("DA"));
}
CPDF_Font* CPDF_InterForm::GetDefaultFormFont() {
@@ -1274,7 +1274,7 @@ CPDF_Font* CPDF_InterForm::GetDefaultFormFont() {
}
int CPDF_InterForm::GetFormAlignment() {
- return m_pFormDict ? m_pFormDict->GetIntegerBy("Q", 0) : 0;
+ return m_pFormDict ? m_pFormDict->GetIntegerFor("Q", 0) : 0;
}
bool CPDF_InterForm::ResetForm(const std::vector<CPDF_FormField*>& fields,
@@ -1321,7 +1321,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
return;
uint32_t dwParentObjNum = pFieldDict->GetObjNum();
- CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids");
+ CPDF_Array* pKids = pFieldDict->GetArrayFor("Kids");
if (!pKids) {
AddTerminalField(pFieldDict);
return;
@@ -1345,7 +1345,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
}
FX_BOOL CPDF_InterForm::HasXFAForm() const {
- return m_pFormDict && m_pFormDict->GetArrayBy("XFA");
+ return m_pFormDict && m_pFormDict->GetArrayFor("XFA");
}
void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
@@ -1353,13 +1353,13 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
if (!pPageDict)
return;
- CPDF_Array* pAnnots = pPageDict->GetArrayBy("Annots");
+ CPDF_Array* pAnnots = pPageDict->GetArrayFor("Annots");
if (!pAnnots)
return;
for (size_t i = 0; i < pAnnots->GetCount(); i++) {
CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i);
- if (pAnnot && pAnnot->GetStringBy("Subtype") == "Widget")
+ if (pAnnot && pAnnot->GetStringFor("Subtype") == "Widget")
LoadField(pAnnot);
}
}
@@ -1378,48 +1378,48 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
if (!pField) {
CPDF_Dictionary* pParent = pFieldDict;
if (!pFieldDict->KeyExist("T") &&
- pFieldDict->GetStringBy("Subtype") == "Widget") {
- pParent = pFieldDict->GetDictBy("Parent");
+ pFieldDict->GetStringFor("Subtype") == "Widget") {
+ pParent = pFieldDict->GetDictFor("Parent");
if (!pParent)
pParent = pFieldDict;
}
if (pParent && pParent != pFieldDict && !pParent->KeyExist("FT")) {
if (pFieldDict->KeyExist("FT")) {
- CPDF_Object* pFTValue = pFieldDict->GetDirectObjectBy("FT");
+ CPDF_Object* pFTValue = pFieldDict->GetDirectObjectFor("FT");
if (pFTValue)
- pParent->SetAt("FT", pFTValue->Clone());
+ pParent->SetFor("FT", pFTValue->Clone());
}
if (pFieldDict->KeyExist("Ff")) {
- CPDF_Object* pFfValue = pFieldDict->GetDirectObjectBy("Ff");
+ CPDF_Object* pFfValue = pFieldDict->GetDirectObjectFor("Ff");
if (pFfValue)
- pParent->SetAt("Ff", pFfValue->Clone());
+ pParent->SetFor("Ff", pFfValue->Clone());
}
}
pField = new CPDF_FormField(this, pParent);
- CPDF_Object* pTObj = pDict->GetObjectBy("T");
+ CPDF_Object* pTObj = pDict->GetObjectFor("T");
if (ToReference(pTObj)) {
CPDF_Object* pClone = pTObj->CloneDirectObject();
if (pClone)
- pDict->SetAt("T", pClone);
+ pDict->SetFor("T", pClone);
else
- pDict->SetAtName("T", "");
+ pDict->SetNameFor("T", "");
}
m_pFieldTree->SetField(csWName, pField);
}
- CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids");
+ CPDF_Array* pKids = pFieldDict->GetArrayFor("Kids");
if (!pKids) {
- if (pFieldDict->GetStringBy("Subtype") == "Widget")
+ if (pFieldDict->GetStringFor("Subtype") == "Widget")
AddControl(pField, pFieldDict);
} else {
for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid)
continue;
- if (pKid->GetStringBy("Subtype") != "Widget")
+ if (pKid->GetStringFor("Subtype") != "Widget")
continue;
AddControl(pField, pKid);
@@ -1464,7 +1464,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->GetStringBy("V").IsEmpty())
+ if ((dwFlags & 0x02) != 0 && pFieldDict->GetStringFor("V").IsEmpty())
return pField;
}
}
@@ -1489,21 +1489,21 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
if (!pDoc)
return nullptr;
- CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDictBy("FDF");
+ CPDF_Dictionary* pMainDict = pDoc->GetRoot()->GetDictFor("FDF");
if (!pdf_path.IsEmpty()) {
if (bSimpleFileSpec) {
CFX_WideString wsFilePath = CPDF_FileSpec::EncodeFileName(pdf_path);
- pMainDict->SetAtString("F", CFX_ByteString::FromUnicode(wsFilePath));
- pMainDict->SetAtString("UF", PDF_EncodeText(wsFilePath));
+ pMainDict->SetStringFor("F", CFX_ByteString::FromUnicode(wsFilePath));
+ pMainDict->SetStringFor("UF", PDF_EncodeText(wsFilePath));
} else {
CPDF_FileSpec filespec;
filespec.SetFileName(pdf_path);
- pMainDict->SetAt("F", filespec.GetObj());
+ pMainDict->SetFor("F", filespec.GetObj());
}
}
CPDF_Array* pFields = new CPDF_Array;
- pMainDict->SetAt("Fields", pFields);
+ pMainDict->SetFor("Fields", pFields);
int nCount = m_pFieldTree->m_Root.CountFields();
for (int i = 0; i < nCount; i++) {
CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i);
@@ -1515,25 +1515,25 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
continue;
if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) {
- if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringBy("V").IsEmpty())
+ if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringFor("V").IsEmpty())
continue;
CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict());
CPDF_Dictionary* pFieldDict = new CPDF_Dictionary;
- pFieldDict->SetAt("T", new CPDF_String(fullname));
+ pFieldDict->SetFor("T", new CPDF_String(fullname));
if (pField->GetType() == CPDF_FormField::CheckBox ||
pField->GetType() == CPDF_FormField::RadioButton) {
CFX_WideString csExport = pField->GetCheckValue(FALSE);
CFX_ByteString csBExport = PDF_EncodeText(csExport);
CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt");
if (pOpt)
- pFieldDict->SetAtString("V", csBExport);
+ pFieldDict->SetStringFor("V", csBExport);
else
- pFieldDict->SetAtName("V", csBExport);
+ pFieldDict->SetNameFor("V", csBExport);
} else {
CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V");
if (pV)
- pFieldDict->SetAt("V", pV->CloneDirectObject());
+ pFieldDict->SetFor("V", pV->CloneDirectObject());
}
pFields->Add(pFieldDict);
}
@@ -1549,8 +1549,8 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
if (!parent_name.IsEmpty())
name = parent_name + L".";
- name += pFieldDict->GetUnicodeTextBy("T");
- CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids");
+ name += pFieldDict->GetUnicodeTextFor("T");
+ CPDF_Array* pKids = pFieldDict->GetArrayFor("Kids");
if (pKids) {
for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
@@ -1585,8 +1585,8 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
CPDF_FormField::Type eType = pField->GetType();
if ((eType == CPDF_FormField::ListBox || eType == CPDF_FormField::ComboBox) &&
pFieldDict->KeyExist("Opt")) {
- pField->m_pDict->SetAt(
- "Opt", pFieldDict->GetDirectObjectBy("Opt")->CloneDirectObject());
+ pField->m_pDict->SetFor(
+ "Opt", pFieldDict->GetDirectObjectFor("Opt")->CloneDirectObject());
}
if (bNotify && m_pFormNotify) {
@@ -1604,15 +1604,15 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
if (!pFDF)
return FALSE;
- CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictBy("FDF");
+ CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDictFor("FDF");
if (!pMainDict)
return FALSE;
- CPDF_Array* pFields = pMainDict->GetArrayBy("Fields");
+ CPDF_Array* pFields = pMainDict->GetArrayFor("Fields");
if (!pFields)
return FALSE;
- m_bsEncoding = pMainDict->GetStringBy("Encoding");
+ m_bsEncoding = pMainDict->GetStringFor("Encoding");
if (bNotify && m_pFormNotify && m_pFormNotify->BeforeFormImportData(this) < 0)
return FALSE;
diff --git a/core/fpdfdoc/cpdf_link.cpp b/core/fpdfdoc/cpdf_link.cpp
index 4859881198..b92b3cf45f 100644
--- a/core/fpdfdoc/cpdf_link.cpp
+++ b/core/fpdfdoc/cpdf_link.cpp
@@ -10,11 +10,11 @@
#include "core/fpdfdoc/include/cpdf_nametree.h"
CFX_FloatRect CPDF_Link::GetRect() {
- return m_pDict->GetRectBy("Rect");
+ return m_pDict->GetRectFor("Rect");
}
CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) {
- CPDF_Object* pDest = m_pDict->GetDirectObjectBy("Dest");
+ CPDF_Object* pDest = m_pDict->GetDirectObjectFor("Dest");
if (!pDest)
return CPDF_Dest();
@@ -28,5 +28,5 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) {
}
CPDF_Action CPDF_Link::GetAction() {
- return CPDF_Action(m_pDict->GetDictBy("A"));
+ return CPDF_Action(m_pDict->GetDictFor("A"));
}
diff --git a/core/fpdfdoc/cpdf_linklist.cpp b/core/fpdfdoc/cpdf_linklist.cpp
index 5ef8f39da6..d9a10ef3e2 100644
--- a/core/fpdfdoc/cpdf_linklist.cpp
+++ b/core/fpdfdoc/cpdf_linklist.cpp
@@ -57,13 +57,13 @@ 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->GetArrayBy("Annots");
+ CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayFor("Annots");
if (!pAnnotList)
return;
for (size_t i = 0; i < pAnnotList->GetCount(); ++i) {
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i);
- bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link");
+ bool add_link = (pAnnot && pAnnot->GetStringFor("Subtype") == "Link");
// Add non-links as nullptrs to preserve z-order.
pList->push_back(add_link ? pAnnot : nullptr);
}
diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
index b53da07652..ee6647f07f 100644
--- a/core/fpdfdoc/cpdf_metadata.cpp
+++ b/core/fpdfdoc/cpdf_metadata.cpp
@@ -16,7 +16,7 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) {
if (!pRoot)
return;
- CPDF_Stream* pStream = pRoot->GetStreamBy("Metadata");
+ CPDF_Stream* pStream = pRoot->GetStreamFor("Metadata");
if (!pStream)
return;
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index e046b6bf1a..a18ea217ae 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -22,7 +22,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (nLevel > nMaxRecursion)
return nullptr;
- CPDF_Array* pLimits = pNode->GetArrayBy("Limits");
+ CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
if (pLimits) {
CFX_ByteString csLeft = pLimits->GetStringAt(0);
CFX_ByteString csRight = pLimits->GetStringAt(1);
@@ -37,7 +37,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
}
- CPDF_Array* pNames = pNode->GetArrayBy("Names");
+ CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pNames) {
size_t dwCount = pNames->GetCount() / 2;
for (size_t i = 0; i < dwCount; i++) {
@@ -58,7 +58,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return nullptr;
}
- CPDF_Array* pKids = pNode->GetArrayBy("Kids");
+ CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return nullptr;
@@ -84,7 +84,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (nLevel > nMaxRecursion)
return nullptr;
- CPDF_Array* pNames = pNode->GetArrayBy("Names");
+ CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pNames) {
size_t nCount = pNames->GetCount() / 2;
if (nIndex >= nCurIndex + nCount) {
@@ -96,7 +96,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
return pNames->GetDirectObjectAt((nIndex - nCurIndex) * 2 + 1);
}
- CPDF_Array* pKids = pNode->GetArrayBy("Kids");
+ CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return nullptr;
for (size_t i = 0; i < pKids->GetCount(); i++) {
@@ -115,11 +115,11 @@ size_t CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
if (nLevel > nMaxRecursion)
return 0;
- CPDF_Array* pNames = pNode->GetArrayBy("Names");
+ CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pNames)
return pNames->GetCount() / 2;
- CPDF_Array* pKids = pNode->GetArrayBy("Kids");
+ CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return 0;
@@ -143,11 +143,11 @@ CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc,
if (!pRoot)
return;
- CPDF_Dictionary* pNames = pRoot->GetDictBy("Names");
+ CPDF_Dictionary* pNames = pRoot->GetDictFor("Names");
if (!pNames)
return;
- m_pRoot = pNames->GetDictBy(category);
+ m_pRoot = pNames->GetDictFor(category);
}
size_t CPDF_NameTree::GetCount() const {
@@ -183,16 +183,16 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
const CFX_ByteString& sName) {
CPDF_Object* pValue = LookupValue(sName);
if (!pValue) {
- CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictBy("Dests");
+ CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictFor("Dests");
if (!pDests)
return nullptr;
- pValue = pDests->GetDirectObjectBy(sName);
+ pValue = pDests->GetDirectObjectFor(sName);
}
if (!pValue)
return nullptr;
if (CPDF_Array* pArray = pValue->AsArray())
return pArray;
if (CPDF_Dictionary* pDict = pValue->AsDictionary())
- return pDict->GetArrayBy("D");
+ return pDict->GetArrayFor("D");
return nullptr;
}
diff --git a/core/fpdfdoc/cpdf_numbertree.cpp b/core/fpdfdoc/cpdf_numbertree.cpp
index 9e2881f414..36d18c2d19 100644
--- a/core/fpdfdoc/cpdf_numbertree.cpp
+++ b/core/fpdfdoc/cpdf_numbertree.cpp
@@ -12,12 +12,12 @@
namespace {
CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) {
- CPDF_Array* pLimits = pNode->GetArrayBy("Limits");
+ CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
if (pLimits &&
(num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) {
return nullptr;
}
- CPDF_Array* pNumbers = pNode->GetArrayBy("Nums");
+ CPDF_Array* pNumbers = pNode->GetArrayFor("Nums");
if (pNumbers) {
for (size_t i = 0; i < pNumbers->GetCount() / 2; i++) {
int index = pNumbers->GetIntegerAt(i * 2);
@@ -29,7 +29,7 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) {
return nullptr;
}
- CPDF_Array* pKids = pNode->GetArrayBy("Kids");
+ CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return nullptr;
diff --git a/core/fpdfdoc/cpdf_occontext.cpp b/core/fpdfdoc/cpdf_occontext.cpp
index e641286ff0..b04c2bdcbb 100644
--- a/core/fpdfdoc/cpdf_occontext.cpp
+++ b/core/fpdfdoc/cpdf_occontext.cpp
@@ -26,7 +26,7 @@ int32_t FindGroup(const CPDF_Array* pArray, const CPDF_Dictionary* pGroupDict) {
bool HasIntent(const CPDF_Dictionary* pDict,
const CFX_ByteStringC& csElement,
const CFX_ByteStringC& csDef) {
- CPDF_Object* pIntent = pDict->GetDirectObjectBy("Intent");
+ CPDF_Object* pIntent = pDict->GetDirectObjectFor("Intent");
if (!pIntent)
return csElement == csDef;
@@ -46,19 +46,19 @@ bool HasIntent(const CPDF_Dictionary* pDict,
CPDF_Dictionary* GetConfig(CPDF_Document* pDoc,
const CPDF_Dictionary* pOCGDict) {
ASSERT(pOCGDict);
- CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDictBy("OCProperties");
+ CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDictFor("OCProperties");
if (!pOCProperties)
return nullptr;
- CPDF_Array* pOCGs = pOCProperties->GetArrayBy("OCGs");
+ CPDF_Array* pOCGs = pOCProperties->GetArrayFor("OCGs");
if (!pOCGs)
return nullptr;
if (FindGroup(pOCGs, pOCGDict) < 0)
return nullptr;
- CPDF_Dictionary* pConfig = pOCProperties->GetDictBy("D");
- CPDF_Array* pConfigs = pOCProperties->GetArrayBy("Configs");
+ CPDF_Dictionary* pConfig = pOCProperties->GetDictFor("D");
+ CPDF_Array* pConfigs = pOCProperties->GetArrayFor("Configs");
if (!pConfigs)
return pConfig;
@@ -105,18 +105,18 @@ bool CPDF_OCContext::LoadOCGStateFromConfig(
if (!pConfig)
return true;
- bool bState = pConfig->GetStringBy("BaseState", "ON") != "OFF";
- CPDF_Array* pArray = pConfig->GetArrayBy("ON");
+ bool bState = pConfig->GetStringFor("BaseState", "ON") != "OFF";
+ CPDF_Array* pArray = pConfig->GetArrayFor("ON");
if (pArray) {
if (FindGroup(pArray, pOCGDict) >= 0)
bState = true;
}
- pArray = pConfig->GetArrayBy("OFF");
+ pArray = pConfig->GetArrayFor("OFF");
if (pArray) {
if (FindGroup(pArray, pOCGDict) >= 0)
bState = false;
}
- pArray = pConfig->GetArrayBy("AS");
+ pArray = pConfig->GetArrayFor("AS");
if (!pArray)
return bState;
@@ -126,21 +126,21 @@ bool CPDF_OCContext::LoadOCGStateFromConfig(
if (!pUsage)
continue;
- if (pUsage->GetStringBy("Event", "View") != csConfig)
+ if (pUsage->GetStringFor("Event", "View") != csConfig)
continue;
- CPDF_Array* pOCGs = pUsage->GetArrayBy("OCGs");
+ CPDF_Array* pOCGs = pUsage->GetArrayFor("OCGs");
if (!pOCGs)
continue;
if (FindGroup(pOCGs, pOCGDict) < 0)
continue;
- CPDF_Dictionary* pState = pUsage->GetDictBy(csConfig);
+ CPDF_Dictionary* pState = pUsage->GetDictFor(csConfig);
if (!pState)
continue;
- bState = pState->GetStringBy(csFind) != "OFF";
+ bState = pState->GetStringFor(csFind) != "OFF";
}
return bState;
}
@@ -150,18 +150,18 @@ bool CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const {
return true;
CFX_ByteString csState = GetUsageTypeString(m_eUsageType);
- CPDF_Dictionary* pUsage = pOCGDict->GetDictBy("Usage");
+ CPDF_Dictionary* pUsage = pOCGDict->GetDictFor("Usage");
if (pUsage) {
- CPDF_Dictionary* pState = pUsage->GetDictBy(csState);
+ CPDF_Dictionary* pState = pUsage->GetDictFor(csState);
if (pState) {
CFX_ByteString csFind = csState + "State";
if (pState->KeyExist(csFind))
- return pState->GetStringBy(csFind) != "OFF";
+ return pState->GetStringFor(csFind) != "OFF";
}
if (csState != "View") {
- pState = pUsage->GetDictBy("View");
+ pState = pUsage->GetDictFor("View");
if (pState && pState->KeyExist("ViewState"))
- return pState->GetStringBy("ViewState") != "OFF";
+ return pState->GetStringFor("ViewState") != "OFF";
}
}
return LoadOCGStateFromConfig(csState, pOCGDict);
@@ -237,12 +237,12 @@ bool CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression, int nLevel) {
}
bool CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict) {
- CPDF_Array* pVE = pOCMDDict->GetArrayBy("VE");
+ CPDF_Array* pVE = pOCMDDict->GetArrayFor("VE");
if (pVE)
return GetOCGVE(pVE, 0);
- CFX_ByteString csP = pOCMDDict->GetStringBy("P", "AnyOn");
- CPDF_Object* pOCGObj = pOCMDDict->GetDirectObjectBy("OCGs");
+ CFX_ByteString csP = pOCMDDict->GetStringFor("P", "AnyOn");
+ CPDF_Object* pOCGObj = pOCMDDict->GetDirectObjectFor("OCGs");
if (!pOCGObj)
return true;
@@ -272,7 +272,7 @@ bool CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) {
if (!pOCGDict)
return true;
- CFX_ByteString csType = pOCGDict->GetStringBy("Type", "OCG");
+ CFX_ByteString csType = pOCGDict->GetStringFor("Type", "OCG");
if (csType == "OCG")
return GetOCGVisible(pOCGDict);
return LoadOCMDState(pOCGDict);
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index 4b888b9a61..2f02e84bf3 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -84,7 +84,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
if (!pPDFRoot)
return wsLabel;
- CPDF_Dictionary* pLabels = pPDFRoot->GetDictBy("PageLabels");
+ CPDF_Dictionary* pLabels = pPDFRoot->GetDictFor("PageLabels");
CPDF_NumberTree numberTree(pLabels);
CPDF_Object* pValue = nullptr;
int n = nPage;
@@ -99,10 +99,10 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
pValue = pValue->GetDirect();
if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) {
if (pLabel->KeyExist("P"))
- wsLabel += pLabel->GetUnicodeTextBy("P");
+ wsLabel += pLabel->GetUnicodeTextFor("P");
- CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", "");
- int nLabelNum = nPage - n + pLabel->GetIntegerBy("St", 1);
+ CFX_ByteString bsNumberingStyle = pLabel->GetStringFor("S", "");
+ int nLabelNum = nPage - n + pLabel->GetIntegerFor("St", 1);
CFX_WideString wsNumPortion =
GetLabelNumPortion(nLabelNum, bsNumberingStyle);
wsLabel += wsNumPortion;
diff --git a/core/fpdfdoc/cpdf_viewerpreferences.cpp b/core/fpdfdoc/cpdf_viewerpreferences.cpp
index 4951e5ff5d..0dc55aad74 100644
--- a/core/fpdfdoc/cpdf_viewerpreferences.cpp
+++ b/core/fpdfdoc/cpdf_viewerpreferences.cpp
@@ -15,30 +15,30 @@ CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {}
FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetStringBy("Direction") == "R2L" : FALSE;
+ return pDict ? pDict->GetStringFor("Direction") == "R2L" : FALSE;
}
FX_BOOL CPDF_ViewerPreferences::PrintScaling() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetStringBy("PrintScaling") != "None" : TRUE;
+ return pDict ? pDict->GetStringFor("PrintScaling") != "None" : TRUE;
}
int32_t CPDF_ViewerPreferences::NumCopies() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetIntegerBy("NumCopies") : 1;
+ return pDict ? pDict->GetIntegerFor("NumCopies") : 1;
}
CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetArrayBy("PrintPageRange") : nullptr;
+ return pDict ? pDict->GetArrayFor("PrintPageRange") : nullptr;
}
CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
CPDF_Dictionary* pDict = GetViewerPreferences();
- return pDict ? pDict->GetStringBy("Duplex") : CFX_ByteString("None");
+ return pDict ? pDict->GetStringFor("Duplex") : CFX_ByteString("None");
}
CPDF_Dictionary* CPDF_ViewerPreferences::GetViewerPreferences() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- return pDict ? pDict->GetDictBy("ViewerPreferences") : nullptr;
+ return pDict ? pDict->GetDictFor("ViewerPreferences") : nullptr;
}
diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp
index ea4aad96d3..7eff694d81 100644
--- a/core/fpdfdoc/cpvt_fontmap.cpp
+++ b/core/fpdfdoc/cpvt_fontmap.cpp
@@ -32,14 +32,14 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc,
return;
CFX_ByteString sFontAlias;
- CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictBy("AcroForm");
+ CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictFor("AcroForm");
CPDF_Font* pPDFFont = AddNativeInterFormFont(pFormDict, pDoc, sSysFontAlias);
if (!pPDFFont)
return;
- if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) {
+ if (CPDF_Dictionary* pFontList = pResDict->GetDictFor("Font")) {
if (!pFontList->KeyExist(sSysFontAlias))
- pFontList->SetAtReference(sSysFontAlias, pDoc, pPDFFont->GetFontDict());
+ pFontList->SetReferenceFor(sSysFontAlias, pDoc, pPDFFont->GetFontDict());
}
pSysFont = pPDFFont;
}
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index dbfcdbffed..decc408c33 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -25,7 +25,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
const int32_t& nWidgetType) {
CPDF_Dictionary* pFormDict = nullptr;
if (CPDF_Dictionary* pRootDict = pDoc->GetRoot())
- pFormDict = pRootDict->GetDictBy("AcroForm");
+ pFormDict = pRootDict->GetDictFor("AcroForm");
if (!pFormDict)
return false;
@@ -33,7 +33,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
if (CPDF_Object* pDAObj = FPDF_GetFieldAttr(pAnnotDict, "DA"))
DA = pDAObj->GetString();
if (DA.IsEmpty())
- DA = pFormDict->GetStringBy("DA");
+ DA = pFormDict->GetStringFor("DA");
if (DA.IsEmpty())
return false;
@@ -46,32 +46,32 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
FX_FLOAT fFontSize = FX_atof(syntax.GetWord());
CPVT_Color crText = CPVT_Color::ParseColor(DA);
- CPDF_Dictionary* pDRDict = pFormDict->GetDictBy("DR");
+ CPDF_Dictionary* pDRDict = pFormDict->GetDictFor("DR");
if (!pDRDict)
return false;
- CPDF_Dictionary* pDRFontDict = pDRDict->GetDictBy("Font");
+ CPDF_Dictionary* pDRFontDict = pDRDict->GetDictFor("Font");
if (!pDRFontDict)
return false;
- CPDF_Dictionary* pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1));
+ CPDF_Dictionary* pFontDict = pDRFontDict->GetDictFor(sFontName.Mid(1));
if (!pFontDict) {
pFontDict = new CPDF_Dictionary;
- pFontDict->SetAtName("Type", "Font");
- pFontDict->SetAtName("Subtype", "Type1");
- pFontDict->SetAtName("BaseFont", "Helvetica");
- pFontDict->SetAtName("Encoding", "WinAnsiEncoding");
+ pFontDict->SetNameFor("Type", "Font");
+ pFontDict->SetNameFor("Subtype", "Type1");
+ pFontDict->SetNameFor("BaseFont", "Helvetica");
+ pFontDict->SetNameFor("Encoding", "WinAnsiEncoding");
pDoc->AddIndirectObject(pFontDict);
- pDRFontDict->SetAtReference(sFontName.Mid(1), pDoc, pFontDict);
+ pDRFontDict->SetReferenceFor(sFontName.Mid(1), pDoc, pFontDict);
}
CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict);
if (!pDefFont)
return false;
- CFX_FloatRect rcAnnot = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rcAnnot = pAnnotDict->GetRectFor("Rect");
int32_t nRotate = 0;
- if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK"))
- nRotate = pMKDict->GetIntegerBy("R");
+ if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictFor("MK"))
+ nRotate = pMKDict->GetIntegerFor("R");
CFX_FloatRect rcBBox;
CFX_Matrix matrix;
@@ -102,15 +102,15 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
FX_FLOAT fBorderWidth = 1;
CPVT_Dash dsBorder(3, 0, 0);
CPVT_Color crLeftTop, crRightBottom;
- if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDictBy("BS")) {
+ if (CPDF_Dictionary* pBSDict = pAnnotDict->GetDictFor("BS")) {
if (pBSDict->KeyExist("W"))
- fBorderWidth = pBSDict->GetNumberBy("W");
+ fBorderWidth = pBSDict->GetNumberFor("W");
- if (CPDF_Array* pArray = pBSDict->GetArrayBy("D")) {
+ if (CPDF_Array* pArray = pBSDict->GetArrayFor("D")) {
dsBorder = CPVT_Dash(pArray->GetIntegerAt(0), pArray->GetIntegerAt(1),
pArray->GetIntegerAt(2));
}
- switch (pBSDict->GetStringBy("S").GetAt(0)) {
+ switch (pBSDict->GetStringFor("S").GetAt(0)) {
case 'S':
nBorderStyle = BorderStyle::SOLID;
break;
@@ -135,10 +135,10 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
}
}
CPVT_Color crBorder, crBG;
- if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK")) {
- if (CPDF_Array* pArray = pMKDict->GetArrayBy("BC"))
+ if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictFor("MK")) {
+ if (CPDF_Array* pArray = pMKDict->GetArrayFor("BC"))
crBorder = CPVT_Color::ParseColor(*pArray);
- if (CPDF_Array* pArray = pMKDict->GetArrayBy("BG"))
+ if (CPDF_Array* pArray = pMKDict->GetArrayFor("BG"))
crBG = CPVT_Color::ParseColor(*pArray);
}
CFX_ByteTextBuf sAppStream;
@@ -159,33 +159,33 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
CFX_FloatRect(rcBBox.left + fBorderWidth, rcBBox.bottom + fBorderWidth,
rcBBox.right - fBorderWidth, rcBBox.top - fBorderWidth);
rcBody.Normalize();
- CPDF_Dictionary* pAPDict = pAnnotDict->GetDictBy("AP");
+ CPDF_Dictionary* pAPDict = pAnnotDict->GetDictFor("AP");
if (!pAPDict) {
pAPDict = new CPDF_Dictionary;
- pAnnotDict->SetAt("AP", pAPDict);
+ pAnnotDict->SetFor("AP", pAPDict);
}
- CPDF_Stream* pNormalStream = pAPDict->GetStreamBy("N");
+ CPDF_Stream* pNormalStream = pAPDict->GetStreamFor("N");
if (!pNormalStream) {
pNormalStream = new CPDF_Stream(nullptr, 0, nullptr);
int32_t objnum = pDoc->AddIndirectObject(pNormalStream);
- pAnnotDict->GetDictBy("AP")->SetAtReference("N", pDoc, objnum);
+ pAnnotDict->GetDictFor("AP")->SetReferenceFor("N", pDoc, objnum);
}
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
if (pStreamDict) {
- pStreamDict->SetAtMatrix("Matrix", matrix);
- pStreamDict->SetAtRect("BBox", rcBBox);
- CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources");
+ pStreamDict->SetMatrixFor("Matrix", matrix);
+ pStreamDict->SetRectFor("BBox", rcBBox);
+ CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources");
if (pStreamResList) {
- CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font");
+ CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font");
if (!pStreamResFontList) {
pStreamResFontList = new CPDF_Dictionary;
- pStreamResList->SetAt("Font", pStreamResFontList);
+ pStreamResList->SetFor("Font", pStreamResFontList);
}
if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict);
+ pStreamResFontList->SetReferenceFor(sFontName, pDoc, pFontDict);
} else {
- pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone());
- pStreamResList = pStreamDict->GetDictBy("Resources");
+ pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone());
+ pStreamResList = pStreamDict->GetDictFor("Resources");
}
}
switch (nWidgetType) {
@@ -205,7 +205,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
? FPDF_GetFieldAttr(pAnnotDict, "MaxLen")->GetInteger()
: 0;
CPVT_FontMap map(
- pDoc, pStreamDict ? pStreamDict->GetDictBy("Resources") : nullptr,
+ pDoc, pStreamDict ? pStreamDict->GetDictFor("Resources") : nullptr,
pDefFont, sFontName.Right(sFontName.GetLength() - 1));
CPDF_VariableText::Provider prd(&map);
CPDF_VariableText vt;
@@ -266,7 +266,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText()
: CFX_WideString();
CPVT_FontMap map(
- pDoc, pStreamDict ? pStreamDict->GetDictBy("Resources") : nullptr,
+ pDoc, pStreamDict ? pStreamDict->GetDictFor("Resources") : nullptr,
pDefFont, sFontName.Right(sFontName.GetLength() - 1));
CPDF_VariableText::Provider prd(&map);
CPDF_VariableText vt;
@@ -336,7 +336,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
} break;
case 2: {
CPVT_FontMap map(
- pDoc, pStreamDict ? pStreamDict->GetDictBy("Resources") : nullptr,
+ pDoc, pStreamDict ? pStreamDict->GetDictFor("Resources") : nullptr,
pDefFont, sFontName.Right(sFontName.GetLength() - 1));
CPDF_VariableText::Provider prd(&map);
CPDF_Array* pOpts = ToArray(FPDF_GetFieldAttr(pAnnotDict, "Opt"));
@@ -422,20 +422,21 @@ bool GenerateWidgetAP(CPDF_Document* pDoc,
FALSE);
pStreamDict = pNormalStream->GetDict();
if (pStreamDict) {
- pStreamDict->SetAtMatrix("Matrix", matrix);
- pStreamDict->SetAtRect("BBox", rcBBox);
- CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources");
+ pStreamDict->SetMatrixFor("Matrix", matrix);
+ pStreamDict->SetRectFor("BBox", rcBBox);
+ CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources");
if (pStreamResList) {
- CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font");
+ CPDF_Dictionary* pStreamResFontList =
+ pStreamResList->GetDictFor("Font");
if (!pStreamResFontList) {
pStreamResFontList = new CPDF_Dictionary;
- pStreamResList->SetAt("Font", pStreamResFontList);
+ pStreamResList->SetFor("Font", pStreamResFontList);
}
if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict);
+ pStreamResFontList->SetReferenceFor(sFontName, pDoc, pFontDict);
} else {
- pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone());
- pStreamResList = pStreamDict->GetDictBy("Resources");
+ pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone());
+ pStreamResList = pStreamDict->GetDictFor("Resources");
}
}
}
@@ -454,12 +455,12 @@ CFX_ByteString GetColorStringWithDefault(CPDF_Array* pColor,
}
FX_FLOAT GetBorderWidth(const CPDF_Dictionary& pAnnotDict) {
- if (CPDF_Dictionary* pBorderStyleDict = pAnnotDict.GetDictBy("BS")) {
+ if (CPDF_Dictionary* pBorderStyleDict = pAnnotDict.GetDictFor("BS")) {
if (pBorderStyleDict->KeyExist("W"))
- return pBorderStyleDict->GetNumberBy("W");
+ return pBorderStyleDict->GetNumberFor("W");
}
- if (CPDF_Array* pBorderArray = pAnnotDict.GetArrayBy("Border")) {
+ if (CPDF_Array* pBorderArray = pAnnotDict.GetArrayFor("Border")) {
if (pBorderArray->GetCount() > 2)
return pBorderArray->GetNumberAt(2);
}
@@ -468,12 +469,12 @@ FX_FLOAT GetBorderWidth(const CPDF_Dictionary& pAnnotDict) {
}
CPDF_Array* GetDashArray(const CPDF_Dictionary& pAnnotDict) {
- if (CPDF_Dictionary* pBorderStyleDict = pAnnotDict.GetDictBy("BS")) {
- if (pBorderStyleDict->GetStringBy("S") == "D")
- return pBorderStyleDict->GetArrayBy("D");
+ if (CPDF_Dictionary* pBorderStyleDict = pAnnotDict.GetDictFor("BS")) {
+ if (pBorderStyleDict->GetStringFor("S") == "D")
+ return pBorderStyleDict->GetArrayFor("D");
}
- if (CPDF_Array* pBorderArray = pAnnotDict.GetArrayBy("Border")) {
+ if (CPDF_Array* pBorderArray = pAnnotDict.GetArrayFor("Border")) {
if (pBorderArray->GetCount() == 4)
return pBorderArray->GetArrayAt(3);
}
@@ -502,15 +503,15 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc,
const CPDF_Dictionary& pAnnotDict,
CPDF_Font* pDefFont,
const CFX_ByteString& sFontName) {
- CFX_WideString swValue(pAnnotDict.GetUnicodeTextBy("T"));
+ CFX_WideString swValue(pAnnotDict.GetUnicodeTextFor("T"));
swValue += L'\n';
- swValue += pAnnotDict.GetUnicodeTextBy("Contents");
+ swValue += pAnnotDict.GetUnicodeTextFor("Contents");
CPVT_FontMap map(pDoc, nullptr, pDefFont, sFontName);
CPDF_VariableText::Provider prd(&map);
CPDF_VariableText vt;
vt.SetProvider(&prd);
- vt.SetPlateRect(pAnnotDict.GetRectBy("Rect"));
+ vt.SetPlateRect(pAnnotDict.GetRectFor("Rect"));
vt.SetFontSize(12);
vt.SetAutoReturn(TRUE);
vt.SetMultiLine(TRUE);
@@ -538,17 +539,17 @@ CPDF_Dictionary* GenerateExtGStateDict(const CPDF_Dictionary& pAnnotDict,
const CFX_ByteString& sExtGSDictName,
const CFX_ByteString& sBlendMode) {
CPDF_Dictionary* pGSDict = new CPDF_Dictionary;
- pGSDict->SetAtString("Type", "ExtGState");
+ pGSDict->SetStringFor("Type", "ExtGState");
FX_FLOAT fOpacity =
- pAnnotDict.KeyExist("CA") ? pAnnotDict.GetNumberBy("CA") : 1;
- pGSDict->SetAtNumber("CA", fOpacity);
- pGSDict->SetAtNumber("ca", fOpacity);
- pGSDict->SetAtBoolean("AIS", false);
- pGSDict->SetAtString("BM", sBlendMode);
+ pAnnotDict.KeyExist("CA") ? pAnnotDict.GetNumberFor("CA") : 1;
+ pGSDict->SetNumberFor("CA", fOpacity);
+ pGSDict->SetNumberFor("ca", fOpacity);
+ pGSDict->SetBooleanFor("AIS", false);
+ pGSDict->SetStringFor("BM", sBlendMode);
CPDF_Dictionary* pExtGStateDict = new CPDF_Dictionary;
- pExtGStateDict->SetAt(sExtGSDictName, pGSDict);
+ pExtGStateDict->SetFor(sExtGSDictName, pGSDict);
return pExtGStateDict;
}
@@ -556,14 +557,14 @@ CPDF_Dictionary* GenerateExtGStateDict(const CPDF_Dictionary& pAnnotDict,
CPDF_Dictionary* GenerateResourceFontDict(CPDF_Document* pDoc,
const CFX_ByteString& sFontDictName) {
CPDF_Dictionary* pFontDict = new CPDF_Dictionary;
- pFontDict->SetAtName("Type", "Font");
- pFontDict->SetAtName("Subtype", "Type1");
- pFontDict->SetAtName("BaseFont", "Helvetica");
- pFontDict->SetAtName("Encoding", "WinAnsiEncoding");
+ pFontDict->SetNameFor("Type", "Font");
+ pFontDict->SetNameFor("Subtype", "Type1");
+ pFontDict->SetNameFor("BaseFont", "Helvetica");
+ pFontDict->SetNameFor("Encoding", "WinAnsiEncoding");
pDoc->AddIndirectObject(pFontDict);
CPDF_Dictionary* pResourceFontDict = new CPDF_Dictionary;
- pResourceFontDict->SetAtReference(sFontDictName, pDoc, pFontDict);
+ pResourceFontDict->SetReferenceFor(sFontDictName, pDoc, pFontDict);
return pResourceFontDict;
}
@@ -573,10 +574,10 @@ CPDF_Dictionary* GenerateResourceDict(CPDF_Dictionary* pExtGStateDict,
CPDF_Dictionary* pResourceFontDict) {
CPDF_Dictionary* pResourceDict = new CPDF_Dictionary;
if (pExtGStateDict)
- pResourceDict->SetAt("ExtGState", pExtGStateDict);
+ pResourceDict->SetFor("ExtGState", pExtGStateDict);
if (pResourceFontDict)
- pResourceDict->SetAt("Font", pResourceFontDict);
+ pResourceDict->SetFor("Font", pResourceFontDict);
return pResourceDict;
}
@@ -587,24 +588,24 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc,
const CFX_ByteTextBuf& sAppStream,
CPDF_Dictionary* pResourceDict) {
CPDF_Dictionary* pAPDict = new CPDF_Dictionary;
- pAnnotDict->SetAt("AP", pAPDict);
+ pAnnotDict->SetFor("AP", pAPDict);
CPDF_Stream* pNormalStream = new CPDF_Stream(nullptr, 0, nullptr);
int32_t objnum = pDoc->AddIndirectObject(pNormalStream);
- pAnnotDict->GetDictBy("AP")->SetAtReference("N", pDoc, objnum);
+ pAnnotDict->GetDictFor("AP")->SetReferenceFor("N", pDoc, objnum);
pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE,
FALSE);
CPDF_Dictionary* pStreamDict = pNormalStream->GetDict();
- pStreamDict->SetAtInteger("FormType", 1);
- pStreamDict->SetAtString("Subtype", "Form");
- pStreamDict->SetAtMatrix("Matrix", CFX_Matrix());
+ pStreamDict->SetIntegerFor("FormType", 1);
+ pStreamDict->SetStringFor("Subtype", "Form");
+ pStreamDict->SetMatrixFor("Matrix", CFX_Matrix());
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
- pStreamDict->SetAtRect("BBox", rect);
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
+ pStreamDict->SetRectFor("BBox", rect);
- pStreamDict->SetAt("Resources", pResourceDict);
+ pStreamDict->SetFor("Resources", pResourceDict);
}
CFX_ByteString GetPaintOperatorString(bool bIsStrokeRect, bool bIsFillRect) {
@@ -666,7 +667,7 @@ CFX_ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) {
} // namespace
bool FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) {
- if (!pAnnotDict || pAnnotDict->GetStringBy("Subtype") != "Widget")
+ if (!pAnnotDict || pAnnotDict->GetStringFor("Subtype") != "Widget")
return false;
CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString();
@@ -684,9 +685,9 @@ 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->GetDictBy("Parent")) {
+ if (CPDF_Dictionary* pParentDict = pAnnotDict->GetDictFor("Parent")) {
if (pParentDict->KeyExist("AS")) {
- pAnnotDict->SetAtString("AS", pParentDict->GetStringBy("AS"));
+ pAnnotDict->SetStringFor("AS", pParentDict->GetStringFor("AS"));
}
}
}
@@ -719,12 +720,12 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- CPDF_Array* pInteriorColor = pAnnotDict->GetArrayBy("IC");
+ CPDF_Array* pInteriorColor = pAnnotDict->GetArrayFor("IC");
sAppStream << GetColorStringWithDefault(pInteriorColor,
CPVT_Color(CPVT_Color::kTransparent),
PaintOperation::FILL);
- sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayBy("C"),
+ sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
@@ -736,7 +737,7 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc,
sAppStream << GetDashPatternString(*pAnnotDict);
}
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Normalize();
if (bIsStrokeRect) {
@@ -792,11 +793,11 @@ bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayBy("C"),
+ sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
CPVT_Color(CPVT_Color::kRGB, 1, 1, 0),
PaintOperation::FILL);
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Normalize();
sAppStream << rect.left << " " << rect.top << " m " << rect.right << " "
@@ -821,7 +822,7 @@ bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
if (!bIsStroke)
return false;
- CPDF_Array* pInkList = pAnnotDict->GetArrayBy("InkList");
+ CPDF_Array* pInkList = pAnnotDict->GetArrayFor("InkList");
if (!pInkList || pInkList->IsEmpty())
return false;
@@ -829,7 +830,7 @@ bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayBy("C"),
+ sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
@@ -838,9 +839,9 @@ bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc,
// Set inflated rect as a new rect because paths near the border with large
// width should not be clipped to the original rect.
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Inflate(fBorderWidth / 2, fBorderWidth / 2);
- pAnnotDict->SetAtRect("Rect", rect);
+ pAnnotDict->SetRectFor("Rect", rect);
for (size_t i = 0; i < pInkList->GetCount(); i++) {
CPDF_Array* pInkCoordList = pInkList->GetArrayAt(i);
@@ -872,11 +873,11 @@ bool CPVT_GenerateAP::GenerateTextAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
const FX_FLOAT fNoteLength = 20;
CFX_FloatRect noteRect(rect.left, rect.bottom, rect.left + fNoteLength,
rect.bottom + fNoteLength);
- pAnnotDict->SetAtRect("Rect", noteRect);
+ pAnnotDict->SetRectFor("Rect", noteRect);
sAppStream << GenerateTextSymbolAP(noteRect);
@@ -894,11 +895,11 @@ bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayBy("C"),
+ sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Normalize();
FX_FLOAT fLineWidth = 1.0;
@@ -928,7 +929,7 @@ bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc,
const FX_FLOAT fBorderWidth = 1;
sAppStream << fBorderWidth << " w\n";
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Normalize();
rect.Deflate(fBorderWidth / 2, fBorderWidth / 2);
@@ -958,12 +959,12 @@ bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- CPDF_Array* pInteriorColor = pAnnotDict->GetArrayBy("IC");
+ CPDF_Array* pInteriorColor = pAnnotDict->GetArrayFor("IC");
sAppStream << GetColorStringWithDefault(pInteriorColor,
CPVT_Color(CPVT_Color::kTransparent),
PaintOperation::FILL);
- sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayBy("C"),
+ sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
@@ -975,7 +976,7 @@ bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc,
sAppStream << GetDashPatternString(*pAnnotDict);
}
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Normalize();
if (bIsStrokeRect) {
@@ -1005,11 +1006,11 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayBy("C"),
+ sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Normalize();
FX_FLOAT fLineWidth = 1.0;
@@ -1053,11 +1054,11 @@ bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc,
CFX_ByteString sExtGSDictName = "GS";
sAppStream << "/" << sExtGSDictName << " gs ";
- sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayBy("C"),
+ sAppStream << GetColorStringWithDefault(pAnnotDict->GetArrayFor("C"),
CPVT_Color(CPVT_Color::kRGB, 0, 0, 0),
PaintOperation::STROKE);
- CFX_FloatRect rect = pAnnotDict->GetRectBy("Rect");
+ CFX_FloatRect rect = pAnnotDict->GetRectFor("Rect");
rect.Normalize();
FX_FLOAT fLineWidth = 1.0;
diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp
index 80a296af60..6b60e97e9a 100644
--- a/core/fpdfdoc/doc_tagged.cpp
+++ b/core/fpdfdoc/doc_tagged.cpp
@@ -21,8 +21,8 @@ const int nMaxRecursion = 32;
bool IsTagged(const CPDF_Document* pDoc) {
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
- CPDF_Dictionary* pMarkInfo = pCatalog->GetDictBy("MarkInfo");
- return pMarkInfo && pMarkInfo->GetIntegerBy("Marked");
+ CPDF_Dictionary* pMarkInfo = pCatalog->GetDictFor("MarkInfo");
+ return pMarkInfo && pMarkInfo->GetIntegerFor("Marked");
}
} // namespace
@@ -49,8 +49,8 @@ IPDF_StructTree* IPDF_StructTree::LoadDoc(const CPDF_Document* pDoc) {
}
CPDF_StructTreeImpl::CPDF_StructTreeImpl(const CPDF_Document* pDoc)
- : m_pTreeRoot(pDoc->GetRoot()->GetDictBy("StructTreeRoot")),
- m_pRoleMap(m_pTreeRoot ? m_pTreeRoot->GetDictBy("RoleMap") : nullptr),
+ : m_pTreeRoot(pDoc->GetRoot()->GetDictFor("StructTreeRoot")),
+ m_pRoleMap(m_pTreeRoot ? m_pTreeRoot->GetDictFor("RoleMap") : nullptr),
m_pPage(nullptr) {}
CPDF_StructTreeImpl::~CPDF_StructTreeImpl() {}
@@ -68,7 +68,7 @@ void CPDF_StructTreeImpl::LoadDocTree() {
if (!m_pTreeRoot)
return;
- CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectBy("K");
+ CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectFor("K");
if (!pKids)
return;
@@ -93,7 +93,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
if (!m_pTreeRoot)
return;
- CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectBy("K");
+ CPDF_Object* pKids = m_pTreeRoot->GetDirectObjectFor("K");
if (!pKids)
return;
@@ -107,12 +107,12 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
m_Kids.clear();
m_Kids.resize(dwKids);
- CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictBy("ParentTree");
+ CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDictFor("ParentTree");
if (!pParentTree)
return;
CPDF_NumberTree parent_tree(pParentTree);
- int parents_id = pPageDict->GetIntegerBy("StructParents", -1);
+ int parents_id = pPageDict->GetIntegerFor("StructParents", -1);
if (parents_id < 0)
return;
@@ -141,8 +141,8 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(
CPDF_StructElementImpl* pElement =
new CPDF_StructElementImpl(this, nullptr, pDict);
map[pDict] = pElement;
- CPDF_Dictionary* pParent = pDict->GetDictBy("P");
- if (!pParent || pParent->GetStringBy("Type") == "StructTreeRoot") {
+ CPDF_Dictionary* pParent = pDict->GetDictFor("P");
+ if (!pParent || pParent->GetStringFor("Type") == "StructTreeRoot") {
if (!AddTopLevelNode(pDict, pElement)) {
pElement->Release();
map.erase(pDict);
@@ -168,7 +168,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(
}
FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
CPDF_StructElementImpl* pElement) {
- CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectBy("K");
+ CPDF_Object* pObj = m_pTreeRoot->GetDirectObjectFor("K");
if (!pObj)
return FALSE;
@@ -199,9 +199,9 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
m_pTree(pTree),
m_pParent(pParent),
m_pDict(pDict),
- m_Type(pDict->GetStringBy("S")) {
+ m_Type(pDict->GetStringFor("S")) {
if (pTree->m_pRoleMap) {
- CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type);
+ CFX_ByteString mapped = pTree->m_pRoleMap->GetStringFor(m_Type);
if (!mapped.IsEmpty())
m_Type = mapped;
}
@@ -249,12 +249,12 @@ void CPDF_StructElementImpl::Release() {
}
}
void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) {
- CPDF_Object* pObj = pDict->GetObjectBy("Pg");
+ CPDF_Object* pObj = pDict->GetObjectFor("Pg");
uint32_t PageObjNum = 0;
if (CPDF_Reference* pRef = ToReference(pObj))
PageObjNum = pRef->GetRefObjNum();
- CPDF_Object* pKids = pDict->GetDirectObjectBy("K");
+ CPDF_Object* pKids = pDict->GetDirectObjectFor("K");
if (!pKids)
return;
@@ -291,28 +291,28 @@ void CPDF_StructElementImpl::LoadKid(uint32_t PageObjNum,
if (!pKidDict)
return;
- if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectBy("Pg")))
+ if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Pg")))
PageObjNum = pRef->GetRefObjNum();
- CFX_ByteString type = pKidDict->GetStringBy("Type");
+ CFX_ByteString type = pKidDict->GetStringFor("Type");
if (type == "MCR") {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::StreamContent;
- if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectBy("Stm"))) {
+ if (CPDF_Reference* pRef = ToReference(pKidDict->GetObjectFor("Stm"))) {
pKid->m_StreamContent.m_RefObjNum = pRef->GetRefObjNum();
} else {
pKid->m_StreamContent.m_RefObjNum = 0;
}
pKid->m_StreamContent.m_PageObjNum = PageObjNum;
- pKid->m_StreamContent.m_ContentId = pKidDict->GetIntegerBy("MCID");
+ pKid->m_StreamContent.m_ContentId = pKidDict->GetIntegerFor("MCID");
} else if (type == "OBJR") {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::Object;
- if (CPDF_Reference* pObj = ToReference(pKidDict->GetObjectBy("Obj"))) {
+ if (CPDF_Reference* pObj = ToReference(pKidDict->GetObjectFor("Obj"))) {
pKid->m_Object.m_RefObjNum = pObj->GetRefObjNum();
} else {
pKid->m_Object.m_RefObjNum = 0;
@@ -350,7 +350,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
return pDict;
}
}
- if (pDict && pDict->GetStringBy("O") == owner)
+ if (pDict && pDict->GetStringFor("O") == owner)
return pDict;
return nullptr;
}
@@ -371,37 +371,37 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
}
return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
}
- CPDF_Object* pA = m_pDict->GetDirectObjectBy("A");
+ CPDF_Object* pA = m_pDict->GetDirectObjectFor("A");
if (pA) {
CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner);
if (pAttrDict) {
- CPDF_Object* pAttr = pAttrDict->GetDirectObjectBy(CFX_ByteString(name));
+ CPDF_Object* pAttr = pAttrDict->GetDirectObjectFor(CFX_ByteString(name));
if (pAttr) {
return pAttr;
}
}
}
- CPDF_Object* pC = m_pDict->GetDirectObjectBy("C");
+ CPDF_Object* pC = m_pDict->GetDirectObjectFor("C");
if (!pC)
return nullptr;
- CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictBy("ClassMap");
+ CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDictFor("ClassMap");
if (!pClassMap)
return nullptr;
if (CPDF_Array* pArray = pC->AsArray()) {
for (uint32_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString class_name = pArray->GetStringAt(i);
- CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
- if (pClassDict && pClassDict->GetStringBy("O") == owner)
- return pClassDict->GetDirectObjectBy(CFX_ByteString(name));
+ CPDF_Dictionary* pClassDict = pClassMap->GetDictFor(class_name);
+ if (pClassDict && pClassDict->GetStringFor("O") == owner)
+ return pClassDict->GetDirectObjectFor(CFX_ByteString(name));
}
return nullptr;
}
CFX_ByteString class_name = pC->GetString();
- CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
- if (pClassDict && pClassDict->GetStringBy("O") == owner)
- return pClassDict->GetDirectObjectBy(CFX_ByteString(name));
+ CPDF_Dictionary* pClassDict = pClassMap->GetDictFor(class_name);
+ if (pClassDict && pClassDict->GetStringFor("O") == owner)
+ return pClassDict->GetDirectObjectFor(CFX_ByteString(name));
return nullptr;
}
CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
diff --git a/core/fpdfdoc/include/cpdf_action.h b/core/fpdfdoc/include/cpdf_action.h
index 90e33015e7..0b095e4a66 100644
--- a/core/fpdfdoc/include/cpdf_action.h
+++ b/core/fpdfdoc/include/cpdf_action.h
@@ -45,9 +45,9 @@ class CPDF_Action {
CPDF_Dest GetDest(CPDF_Document* pDoc) const;
CFX_WideString GetFilePath() const;
CFX_ByteString GetURI(CPDF_Document* pDoc) const;
- bool GetHideStatus() const { return m_pDict->GetBooleanBy("H", true); }
- CFX_ByteString GetNamedAction() const { return m_pDict->GetStringBy("N"); }
- uint32_t GetFlags() const { return m_pDict->GetIntegerBy("Flags"); }
+ bool GetHideStatus() const { return m_pDict->GetBooleanFor("H", true); }
+ CFX_ByteString GetNamedAction() const { return m_pDict->GetStringFor("N"); }
+ uint32_t GetFlags() const { return m_pDict->GetIntegerFor("Flags"); }
CFX_WideString GetJavaScript() const;
size_t GetSubActionsCount() const;
CPDF_Action GetSubAction(size_t iIndex) const;
diff --git a/core/fpdfdoc/include/cpdf_formcontrol.h b/core/fpdfdoc/include/cpdf_formcontrol.h
index cf246bd878..c73318f49e 100644
--- a/core/fpdfdoc/include/cpdf_formcontrol.h
+++ b/core/fpdfdoc/include/cpdf_formcontrol.h
@@ -50,7 +50,7 @@ class CPDF_FormControl {
CPDF_InterForm* GetInterForm() const { return m_pForm; }
CPDF_FormField* GetField() const { return m_pField; }
CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; }
- CFX_FloatRect GetRect() const { return m_pWidgetDict->GetRectBy("Rect"); }
+ CFX_FloatRect GetRect() const { return m_pWidgetDict->GetRectFor("Rect"); }
void DrawControl(CFX_RenderDevice* pDevice,
CFX_Matrix* pMatrix,