diff options
author | dsinclair <dsinclair@chromium.org> | 2016-09-15 10:15:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-15 10:15:32 -0700 |
commit | 38fd84428a1ea007a043be0b7d9b289e47aa5da0 (patch) | |
tree | 2bae09e8ae60d6d86e451eb7fa212f7aa9d899a8 /fpdfsdk | |
parent | 41d6bbe3d413e7854be89142b70c42a89e315cba (diff) | |
download | pdfium-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 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cba_annotiterator.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_annothandlermgr.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_baannot.cpp | 122 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_document.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_interform.cpp | 12 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_pageview.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_widget.cpp | 36 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cba_fontmap.cpp | 52 | ||||
-rw-r--r-- | fpdfsdk/fpdf_ext.cpp | 12 | ||||
-rw-r--r-- | fpdfsdk/fpdf_flatten.cpp | 88 | ||||
-rw-r--r-- | fpdfsdk/fpdf_transformpage.cpp | 28 | ||||
-rw-r--r-- | fpdfsdk/fpdfdoc.cpp | 12 | ||||
-rw-r--r-- | fpdfsdk/fpdfdoc_unittest.cpp | 80 | ||||
-rw-r--r-- | fpdfsdk/fpdfeditpage.cpp | 22 | ||||
-rw-r--r-- | fpdfsdk/fpdfformfill.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/fpdfppo.cpp | 55 | ||||
-rw-r--r-- | fpdfsdk/fpdfsave.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 12 | ||||
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 23 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Icon.cpp | 8 |
21 files changed, 299 insertions, 297 deletions
diff --git a/fpdfsdk/cba_annotiterator.cpp b/fpdfsdk/cba_annotiterator.cpp index 51ee54beca..feca9fc55b 100644 --- a/fpdfsdk/cba_annotiterator.cpp +++ b/fpdfsdk/cba_annotiterator.cpp @@ -28,7 +28,7 @@ CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, m_pPageView(pPageView), m_nAnnotSubtype(nAnnotSubtype) { CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); - CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetStringBy("Tabs"); + CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs"); if (sTabs == "R") m_eTabOrder = ROW; else if (sTabs == "C") diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 443ee05bb6..f808b8412b 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -63,8 +63,8 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); CPDFSDK_DateTime curTime; - pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); - pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); + pPDFAnnot->GetAnnotDict()->SetStringFor("M", curTime.ToPDFDateTimeString()); + pPDFAnnot->GetAnnotDict()->SetNumberFor("F", 0); GetAnnotHandler(pAnnot)->OnCreate(pAnnot); } diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index 48daaf9d08..e023ae79f1 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -37,7 +37,7 @@ void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) { ASSERT(rect.right - rect.left >= GetMinWidth()); ASSERT(rect.top - rect.bottom >= GetMinHeight()); - m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); + m_pAnnot->GetAnnotDict()->SetRectFor("Rect", rect); } CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const { @@ -57,11 +57,11 @@ void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, } FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { - return !!m_pAnnot->GetAnnotDict()->GetDictBy("AP"); + return !!m_pAnnot->GetAnnotDict()->GetDictFor("AP"); } FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { - CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); + CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); if (!pAP) return FALSE; @@ -75,7 +75,7 @@ FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { ap_entry = "N"; // Get the AP stream or subdirectory - CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); + CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry); return !!psub; } @@ -91,25 +91,25 @@ void CPDFSDK_BAAnnot::ClearCachedAP() { void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { if (sContents.IsEmpty()) - m_pAnnot->GetAnnotDict()->RemoveAt("Contents"); + m_pAnnot->GetAnnotDict()->RemoveFor("Contents"); else - m_pAnnot->GetAnnotDict()->SetAtString("Contents", - PDF_EncodeText(sContents)); + m_pAnnot->GetAnnotDict()->SetStringFor("Contents", + PDF_EncodeText(sContents)); } CFX_WideString CPDFSDK_BAAnnot::GetContents() const { - return m_pAnnot->GetAnnotDict()->GetUnicodeTextBy("Contents"); + return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("Contents"); } void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) { if (sName.IsEmpty()) - m_pAnnot->GetAnnotDict()->RemoveAt("NM"); + m_pAnnot->GetAnnotDict()->RemoveFor("NM"); else - m_pAnnot->GetAnnotDict()->SetAtString("NM", PDF_EncodeText(sName)); + m_pAnnot->GetAnnotDict()->SetStringFor("NM", PDF_EncodeText(sName)); } CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const { - return m_pAnnot->GetAnnotDict()->GetUnicodeTextBy("NM"); + return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("NM"); } void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { @@ -117,14 +117,14 @@ void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { CFX_ByteString str = dt.ToPDFDateTimeString(); if (str.IsEmpty()) - m_pAnnot->GetAnnotDict()->RemoveAt("M"); + m_pAnnot->GetAnnotDict()->RemoveFor("M"); else - m_pAnnot->GetAnnotDict()->SetAtString("M", str); + m_pAnnot->GetAnnotDict()->SetStringFor("M", str); } FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const { FX_SYSTEMTIME systime; - CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringBy("M"); + CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M"); CPDFSDK_DateTime dt(str); dt.ToSystemTime(systime); @@ -133,82 +133,82 @@ FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const { } void CPDFSDK_BAAnnot::SetFlags(uint32_t nFlags) { - m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags); + m_pAnnot->GetAnnotDict()->SetIntegerFor("F", nFlags); } uint32_t CPDFSDK_BAAnnot::GetFlags() const { - return m_pAnnot->GetAnnotDict()->GetIntegerBy("F"); + return m_pAnnot->GetAnnotDict()->GetIntegerFor("F"); } void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) { if (str.IsEmpty()) - m_pAnnot->GetAnnotDict()->RemoveAt("AS"); + m_pAnnot->GetAnnotDict()->RemoveFor("AS"); else - m_pAnnot->GetAnnotDict()->SetAtString("AS", str); + m_pAnnot->GetAnnotDict()->SetStringFor("AS", str); } CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const { - return m_pAnnot->GetAnnotDict()->GetStringBy("AS"); + return m_pAnnot->GetAnnotDict()->GetStringFor("AS"); } void CPDFSDK_BAAnnot::SetStructParent(int key) { - m_pAnnot->GetAnnotDict()->SetAtInteger("StructParent", key); + m_pAnnot->GetAnnotDict()->SetIntegerFor("StructParent", key); } int CPDFSDK_BAAnnot::GetStructParent() const { - return m_pAnnot->GetAnnotDict()->GetIntegerBy("StructParent"); + return m_pAnnot->GetAnnotDict()->GetIntegerFor("StructParent"); } // border void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) { - CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border"); + CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"); if (pBorder) { pBorder->SetAt(2, new CPDF_Number(nWidth)); } else { - CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); + CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); if (!pBSDict) { pBSDict = new CPDF_Dictionary; - m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); + m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); } - pBSDict->SetAtInteger("W", nWidth); + pBSDict->SetIntegerFor("W", nWidth); } } int CPDFSDK_BAAnnot::GetBorderWidth() const { - if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border")) { + if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border")) { return pBorder->GetIntegerAt(2); } - if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS")) { - return pBSDict->GetIntegerBy("W", 1); + if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS")) { + return pBSDict->GetIntegerFor("W", 1); } return 1; } void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) { - CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); + CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); if (!pBSDict) { pBSDict = new CPDF_Dictionary; - m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); + m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); } switch (nStyle) { case BorderStyle::SOLID: - pBSDict->SetAtName("S", "S"); + pBSDict->SetNameFor("S", "S"); break; case BorderStyle::DASH: - pBSDict->SetAtName("S", "D"); + pBSDict->SetNameFor("S", "D"); break; case BorderStyle::BEVELED: - pBSDict->SetAtName("S", "B"); + pBSDict->SetNameFor("S", "B"); break; case BorderStyle::INSET: - pBSDict->SetAtName("S", "I"); + pBSDict->SetNameFor("S", "I"); break; case BorderStyle::UNDERLINE: - pBSDict->SetAtName("S", "U"); + pBSDict->SetNameFor("S", "U"); break; default: break; @@ -216,9 +216,9 @@ void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) { } BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const { - CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); + CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); if (pBSDict) { - CFX_ByteString sBorderStyle = pBSDict->GetStringBy("S", "S"); + CFX_ByteString sBorderStyle = pBSDict->GetStringFor("S", "S"); if (sBorderStyle == "S") return BorderStyle::SOLID; if (sBorderStyle == "D") @@ -231,7 +231,7 @@ BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const { return BorderStyle::UNDERLINE; } - CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border"); + CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"); if (pBorder) { if (pBorder->GetCount() >= 4) { CPDF_Array* pDP = pBorder->GetArrayAt(3); @@ -248,15 +248,15 @@ void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); - m_pAnnot->GetAnnotDict()->SetAt("C", pArray); + m_pAnnot->GetAnnotDict()->SetFor("C", pArray); } void CPDFSDK_BAAnnot::RemoveColor() { - m_pAnnot->GetAnnotDict()->RemoveAt("C"); + m_pAnnot->GetAnnotDict()->RemoveFor("C"); } FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { - if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayBy("C")) { + if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayFor("C")) { size_t nCount = pEntry->GetCount(); if (nCount == 1) { FX_FLOAT g = pEntry->GetNumberAt(0) * 255; @@ -296,11 +296,11 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, const CFX_Matrix& matrix, const CFX_ByteString& sContents, const CFX_ByteString& sAPState) { - CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); + CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); if (!pAPDict) { pAPDict = new CPDF_Dictionary; - m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); + m_pAnnot->GetAnnotDict()->SetFor("AP", pAPDict); } CPDF_Stream* pStream = nullptr; @@ -308,36 +308,36 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, if (sAPState.IsEmpty()) { pParentDict = pAPDict; - pStream = pAPDict->GetStreamBy(sAPType); + pStream = pAPDict->GetStreamFor(sAPType); } else { - CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType); + CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictFor(sAPType); if (!pAPTypeDict) { pAPTypeDict = new CPDF_Dictionary; - pAPDict->SetAt(sAPType, pAPTypeDict); + pAPDict->SetFor(sAPType, pAPTypeDict); } pParentDict = pAPTypeDict; - pStream = pAPTypeDict->GetStreamBy(sAPState); + pStream = pAPTypeDict->GetStreamFor(sAPState); } if (!pStream) { pStream = new CPDF_Stream(nullptr, 0, nullptr); CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); int32_t objnum = pDoc->AddIndirectObject(pStream); - pParentDict->SetAtReference(sAPType, pDoc, objnum); + pParentDict->SetReferenceFor(sAPType, pDoc, objnum); } CPDF_Dictionary* pStreamDict = pStream->GetDict(); if (!pStreamDict) { pStreamDict = new CPDF_Dictionary; - pStreamDict->SetAtName("Type", "XObject"); - pStreamDict->SetAtName("Subtype", "Form"); - pStreamDict->SetAtInteger("FormType", 1); + pStreamDict->SetNameFor("Type", "XObject"); + pStreamDict->SetNameFor("Subtype", "Form"); + pStreamDict->SetIntegerFor("FormType", 1); pStream->InitStream(nullptr, 0, pStreamDict); } if (pStreamDict) { - pStreamDict->SetAtMatrix("Matrix", matrix); - pStreamDict->SetAtRect("BBox", rcBBox); + pStreamDict->SetMatrixFor("Matrix", matrix); + pStreamDict->SetRectFor("BBox", rcBBox); } pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, @@ -351,36 +351,36 @@ FX_BOOL CPDFSDK_BAAnnot::IsVisible() const { } CPDF_Action CPDFSDK_BAAnnot::GetAction() const { - return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictBy("A")); + return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictFor("A")); } void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) { ASSERT(action.GetDict()); - if (action.GetDict() != m_pAnnot->GetAnnotDict()->GetDictBy("A")) { + if (action.GetDict() != m_pAnnot->GetAnnotDict()->GetDictFor("A")) { CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); CPDF_Dictionary* pDict = action.GetDict(); if (pDict && pDict->GetObjNum() == 0) { pDoc->AddIndirectObject(pDict); } - m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum()); + m_pAnnot->GetAnnotDict()->SetReferenceFor("A", pDoc, pDict->GetObjNum()); } } void CPDFSDK_BAAnnot::RemoveAction() { - m_pAnnot->GetAnnotDict()->RemoveAt("A"); + m_pAnnot->GetAnnotDict()->RemoveFor("A"); } CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { - return CPDF_AAction(m_pAnnot->GetAnnotDict()->GetDictBy("AA")); + return CPDF_AAction(m_pAnnot->GetAnnotDict()->GetDictFor("AA")); } void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { - if (aa.GetDict() != m_pAnnot->GetAnnotDict()->GetDictBy("AA")) - m_pAnnot->GetAnnotDict()->SetAt("AA", aa.GetDict()); + if (aa.GetDict() != m_pAnnot->GetAnnotDict()->GetDictFor("AA")) + m_pAnnot->GetAnnotDict()->SetFor("AA", aa.GetDict()); } void CPDFSDK_BAAnnot::RemoveAAction() { - m_pAnnot->GetAnnotDict()->RemoveAt("AA"); + m_pAnnot->GetAnnotDict()->RemoveFor("AA"); } CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { diff --git a/fpdfsdk/cpdfsdk_document.cpp b/fpdfsdk/cpdfsdk_document.cpp index fc09e8a796..339aeab8c6 100644 --- a/fpdfsdk/cpdfsdk_document.cpp +++ b/fpdfsdk/cpdfsdk_document.cpp @@ -103,9 +103,9 @@ FX_BOOL CPDFSDK_Document::ProcOpenAction() { if (!pRoot) return FALSE; - CPDF_Object* pOpenAction = pRoot->GetDictBy("OpenAction"); + CPDF_Object* pOpenAction = pRoot->GetDictFor("OpenAction"); if (!pOpenAction) - pOpenAction = pRoot->GetArrayBy("OpenAction"); + pOpenAction = pRoot->GetArrayFor("OpenAction"); if (!pOpenAction) return FALSE; diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 12def4ca28..e9fb5b4de0 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -100,7 +100,7 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl, CPDF_Document* pDocument = m_pDocument->GetPDFDocument(); CPDFSDK_PageView* pPage = nullptr; - if (CPDF_Dictionary* pPageDict = pControlDict->GetDictBy("P")) { + if (CPDF_Dictionary* pPageDict = pControlDict->GetDictFor("P")) { int nPageIndex = pDocument->GetPageIndex(pPageDict->GetObjNum()); if (nPageIndex >= 0) pPage = m_pDocument->GetPageView(nPageIndex); @@ -147,7 +147,7 @@ int CPDFSDK_InterForm::GetPageIndexByAnnotDict( for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { if (CPDF_Dictionary* pPageDict = pDocument->GetPage(i)) { - if (CPDF_Array* pAnnots = pPageDict->GetArrayBy("Annots")) { + if (CPDF_Array* pAnnots = pPageDict->GetArrayFor("Annots")) { for (int j = 0, jsz = pAnnots->GetCount(); j < jsz; j++) { CPDF_Object* pDict = pAnnots->GetDirectObjectAt(j); if (pAnnotDict == pDict) @@ -484,11 +484,11 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, if (!pFDF) return TRUE; - 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; @@ -498,9 +498,9 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, if (!pField) continue; CFX_WideString name; - name = pField->GetUnicodeTextBy("T"); + name = pField->GetUnicodeTextFor("T"); CFX_ByteString name_b = CFX_ByteString::FromUnicode(name); - CFX_ByteString csBValue = pField->GetStringBy("V"); + CFX_ByteString csBValue = pField->GetStringFor("V"); CFX_WideString csWValue = PDF_DecodeText(csBValue); CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue); diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 7fed794d28..a342e017e4 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -231,7 +231,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CXFA_FFWidget* pPDFAnnot) { #endif // PDF_ENABLE_XFA CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Dictionary* pDict) { - return pDict ? AddAnnot(pDict->GetStringBy("Subtype").c_str(), pDict) + return pDict ? AddAnnot(pDict->GetStringFor("Subtype").c_str(), pDict) : nullptr; } diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 3519b06843..9bc18fae04 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -455,7 +455,7 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( CPDF_Annot::AppearanceMode mode) { - CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); + CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); if (!pAP) return FALSE; @@ -469,7 +469,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( ap_entry = "N"; // Get the AP stream or subdirectory - CPDF_Object* psub = pAP->GetDirectObjectBy(ap_entry); + CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry); if (!psub) return FALSE; @@ -484,7 +484,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( case FIELDTYPE_CHECKBOX: case FIELDTYPE_RADIOBUTTON: if (CPDF_Dictionary* pSubDict = psub->AsDictionary()) { - return !!pSubDict->GetStreamBy(GetAppState()); + return !!pSubDict->GetStreamFor(GetAppState()); } return FALSE; } @@ -970,22 +970,22 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { if (pNormalIcon) { if (CPDF_Dictionary* pImageDict = pNormalIcon->GetDict()) { - if (pImageDict->GetStringBy("Name").IsEmpty()) - pImageDict->SetAtString("Name", "ImgA"); + if (pImageDict->GetStringFor("Name").IsEmpty()) + pImageDict->SetStringFor("Name", "ImgA"); } } if (pRolloverIcon) { if (CPDF_Dictionary* pImageDict = pRolloverIcon->GetDict()) { - if (pImageDict->GetStringBy("Name").IsEmpty()) - pImageDict->SetAtString("Name", "ImgB"); + if (pImageDict->GetStringFor("Name").IsEmpty()) + pImageDict->SetStringFor("Name", "ImgB"); } } if (pDownIcon) { if (CPDF_Dictionary* pImageDict = pDownIcon->GetDict()) { - if (pImageDict->GetStringBy("Name").IsEmpty()) - pImageDict->SetAtString("Name", "ImgC"); + if (pImageDict->GetStringFor("Name").IsEmpty()) + pImageDict->SetStringFor("Name", "ImgC"); } } @@ -1810,33 +1810,33 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); ASSERT(pDoc); - CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); - CPDF_Stream* pStream = pAPDict->GetStreamBy(sAPType); + CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); + CPDF_Stream* pStream = pAPDict->GetStreamFor(sAPType); CPDF_Dictionary* pStreamDict = pStream->GetDict(); CFX_ByteString sImageAlias = "IMG"; if (CPDF_Dictionary* pImageDict = pImage->GetDict()) { - sImageAlias = pImageDict->GetStringBy("Name"); + sImageAlias = pImageDict->GetStringFor("Name"); if (sImageAlias.IsEmpty()) sImageAlias = "IMG"; } - CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); + CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources"); if (!pStreamResList) { pStreamResList = new CPDF_Dictionary(); - pStreamDict->SetAt("Resources", pStreamResList); + pStreamDict->SetFor("Resources", pStreamResList); } if (pStreamResList) { CPDF_Dictionary* pXObject = new CPDF_Dictionary; - pXObject->SetAtReference(sImageAlias, pDoc, pImage); - pStreamResList->SetAt("XObject", pXObject); + pXObject->SetReferenceFor(sImageAlias, pDoc, pImage); + pStreamResList->SetFor("XObject", pXObject); } } void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { - if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP")) - pAPDict->RemoveAt(sAPType); + if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP")) + pAPDict->RemoveFor(sAPType); } FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 575f6c3145..8a981690f1 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -82,7 +82,7 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont, CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset) { - if (m_pAnnotDict->GetStringBy("Subtype") != "Widget") + if (m_pAnnotDict->GetStringFor("Subtype") != "Widget") return nullptr; CPDF_Document* pDocument = GetDocument(); @@ -90,11 +90,11 @@ CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, if (!pRootDict) return nullptr; - CPDF_Dictionary* pAcroFormDict = pRootDict->GetDictBy("AcroForm"); + CPDF_Dictionary* pAcroFormDict = pRootDict->GetDictFor("AcroForm"); if (!pAcroFormDict) return nullptr; - CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR"); + CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictFor("DR"); if (!pDRDict) return nullptr; @@ -111,7 +111,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, if (!pResDict) return nullptr; - CPDF_Dictionary* pFonts = pResDict->GetDictBy("Font"); + CPDF_Dictionary* pFonts = pResDict->GetDictFor("Font"); if (!pFonts) return nullptr; @@ -126,7 +126,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); if (!pElement) continue; - if (pElement->GetStringBy("Type") != "Font") + if (pElement->GetStringFor("Type") != "Font") continue; CPDF_Font* pFont = pDocument->LoadFont(pElement); @@ -153,23 +153,23 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, if (!pFont) return; - CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictBy("AP"); + CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictFor("AP"); if (!pAPDict) { pAPDict = new CPDF_Dictionary; - m_pAnnotDict->SetAt("AP", pAPDict); + m_pAnnotDict->SetFor("AP", pAPDict); } // to avoid checkbox and radiobutton - CPDF_Object* pObject = pAPDict->GetObjectBy(m_sAPType); + CPDF_Object* pObject = pAPDict->GetObjectFor(m_sAPType); if (ToDictionary(pObject)) return; - CPDF_Stream* pStream = pAPDict->GetStreamBy(m_sAPType); + CPDF_Stream* pStream = pAPDict->GetStreamFor(m_sAPType); if (!pStream) { pStream = new CPDF_Stream(nullptr, 0, nullptr); int32_t objnum = m_pDocument->AddIndirectObject(pStream); - pAPDict->SetAtReference(m_sAPType, m_pDocument, objnum); + pAPDict->SetReferenceFor(m_sAPType, m_pDocument, objnum); } CPDF_Dictionary* pStreamDict = pStream->GetDict(); @@ -180,32 +180,32 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, } if (pStreamDict) { - CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); + CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources"); if (!pStreamResList) { pStreamResList = new CPDF_Dictionary(); - pStreamDict->SetAt("Resources", pStreamResList); + pStreamDict->SetFor("Resources", pStreamResList); } if (pStreamResList) { - CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictBy("Font"); + CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font"); if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList); - pStreamResList->SetAtReference("Font", m_pDocument, objnum); + pStreamResList->SetReferenceFor("Font", m_pDocument, objnum); } if (!pStreamResFontList->KeyExist(sAlias)) - pStreamResFontList->SetAtReference(sAlias, m_pDocument, - pFont->GetFontDict()); + pStreamResFontList->SetReferenceFor(sAlias, m_pDocument, + pFont->GetFontDict()); } } } CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) { CPDF_Dictionary* pAcroFormDict = nullptr; - const bool bWidget = (m_pAnnotDict->GetStringBy("Subtype") == "Widget"); + const bool bWidget = (m_pAnnotDict->GetStringFor("Subtype") == "Widget"); if (bWidget) { if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot()) - pAcroFormDict = pRootDict->GetDictBy("AcroForm"); + pAcroFormDict = pRootDict->GetDictFor("AcroForm"); } CFX_ByteString sDA; @@ -228,20 +228,20 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) { sAlias = PDF_NameDecode(sFontName).Mid(1); CPDF_Dictionary* pFontDict = nullptr; - if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictBy("AP")) { - if (CPDF_Dictionary* pNormalDict = pAPDict->GetDictBy("N")) { + if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictFor("AP")) { + if (CPDF_Dictionary* pNormalDict = pAPDict->GetDictFor("N")) { if (CPDF_Dictionary* pNormalResDict = - pNormalDict->GetDictBy("Resources")) { - if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDictBy("Font")) - pFontDict = pResFontDict->GetDictBy(sAlias); + pNormalDict->GetDictFor("Resources")) { + if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDictFor("Font")) + pFontDict = pResFontDict->GetDictFor(sAlias); } } } if (bWidget && !pFontDict && pAcroFormDict) { - if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR")) { - if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictBy("Font")) - pFontDict = pDRFontDict->GetDictBy(sAlias); + if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictFor("DR")) { + if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictFor("Font")) + pFontDict = pDRFontDict->GetDictFor(sAlias); } } diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index 46bc7e57a4..cfa76b5f86 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -53,7 +53,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); CFX_ByteString cbString; if (pAnnotDict->KeyExist("IT")) - cbString = pAnnotDict->GetStringBy("IT"); + cbString = pAnnotDict->GetStringFor("IT"); if (cbString.Compare("Img") != 0) FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA); } else if (nAnnotSubtype == CPDF_Annot::Subtype::MOVIE) { @@ -68,7 +68,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); CFX_ByteString cbString; if (pAnnotDict->KeyExist("FT")) - cbString = pAnnotDict->GetStringBy("FT"); + cbString = pAnnotDict->GetStringFor("FT"); if (cbString.Compare("Sig") == 0) FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG); } @@ -133,14 +133,14 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { return; } if (pRootDict->KeyExist("Names")) { - CPDF_Dictionary* pNameDict = pRootDict->GetDictBy("Names"); + CPDF_Dictionary* pNameDict = pRootDict->GetDictFor("Names"); if (pNameDict && pNameDict->KeyExist("EmbeddedFiles")) { FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT); return; } if (pNameDict && pNameDict->KeyExist("JavaScript")) { - CPDF_Dictionary* pJSDict = pNameDict->GetDictBy("JavaScript"); - CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayBy("Names") : nullptr; + CPDF_Dictionary* pJSDict = pNameDict->GetDictFor("JavaScript"); + CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayFor("Names") : nullptr; if (pArray) { for (size_t i = 0; i < pArray->GetCount(); i++) { CFX_ByteString cbStr = pArray->GetStringAt(i); @@ -177,7 +177,7 @@ DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { if (!pRoot) return PAGEMODE_UNKNOWN; - CPDF_Object* pName = pRoot->GetObjectBy("PageMode"); + CPDF_Object* pName = pRoot->GetObjectFor("PageMode"); if (!pName) return PAGEMODE_USENONE; diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 5b97341765..de6baf1f01 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -55,7 +55,7 @@ void GetContentsRect(CPDF_Document* pDoc, rc.right = pPageObject->m_Right; rc.bottom = pPageObject->m_Bottom; rc.top = pPageObject->m_Top; - if (IsValiableRect(rc, pDict->GetRectBy("MediaBox"))) + if (IsValiableRect(rc, pDict->GetRectFor("MediaBox"))) pRectArray->Add(rc); } } @@ -68,11 +68,11 @@ void ParserStream(CPDF_Dictionary* pPageDic, return; CFX_FloatRect rect; if (pStream->KeyExist("Rect")) - rect = pStream->GetRectBy("Rect"); + rect = pStream->GetRectFor("Rect"); else if (pStream->KeyExist("BBox")) - rect = pStream->GetRectBy("BBox"); + rect = pStream->GetRectFor("BBox"); - if (IsValiableRect(rect, pPageDic->GetRectBy("MediaBox"))) + if (IsValiableRect(rect, pPageDic->GetRectFor("MediaBox"))) pRectArray->Add(rect); pObjectArray->Add(pStream); @@ -87,7 +87,7 @@ int ParserAnnots(CPDF_Document* pSourceDoc, return FLATTEN_FAIL; GetContentsRect(pSourceDoc, pPageDic, pRectArray); - CPDF_Array* pAnnots = pPageDic->GetArrayBy("Annots"); + CPDF_Array* pAnnots = pPageDic->GetArrayFor("Annots"); if (!pAnnots) return FLATTEN_NOTHINGTODO; @@ -97,11 +97,11 @@ int ParserAnnots(CPDF_Document* pSourceDoc, if (!pAnnotDic) continue; - CFX_ByteString sSubtype = pAnnotDic->GetStringBy("Subtype"); + CFX_ByteString sSubtype = pAnnotDic->GetStringFor("Subtype"); if (sSubtype == "Popup") continue; - int nAnnotFlag = pAnnotDic->GetIntegerBy("F"); + int nAnnotFlag = pAnnotDic->GetIntegerFor("F"); if (nAnnotFlag & ANNOTFLAG_HIDDEN) continue; @@ -185,9 +185,9 @@ CFX_FloatRect CalculateRect(CPDF_RectArray* pRectArray) { void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* pDocument) { - CPDF_Object* pContentsObj = pPage->GetStreamBy("Contents"); + CPDF_Object* pContentsObj = pPage->GetStreamFor("Contents"); if (!pContentsObj) { - pContentsObj = pPage->GetArrayBy("Contents"); + pContentsObj = pPage->GetArrayFor("Contents"); } if (!pContentsObj) { @@ -195,8 +195,8 @@ void SetPageContents(CFX_ByteString key, if (!key.IsEmpty()) { CPDF_Stream* pNewContents = new CPDF_Stream(nullptr, 0, new CPDF_Dictionary); - pPage->SetAtReference("Contents", pDocument, - pDocument->AddIndirectObject(pNewContents)); + pPage->SetReferenceFor("Contents", pDocument, + pDocument->AddIndirectObject(pNewContents)); CFX_ByteString sStream; sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()); @@ -236,7 +236,7 @@ void SetPageContents(CFX_ByteString key, return; uint32_t dwObjNum = pDocument->AddIndirectObject(pContentsArray); - pPage->SetAtReference("Contents", pDocument, dwObjNum); + pPage->SetReferenceFor("Contents", pDocument, dwObjNum); if (!key.IsEmpty()) { CPDF_Stream* pNewContents = @@ -330,10 +330,10 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { CFX_FloatRect rcOriginalCB; CFX_FloatRect rcMerger = CalculateRect(&RectArray); - CFX_FloatRect rcOriginalMB = pPageDict->GetRectBy("MediaBox"); + CFX_FloatRect rcOriginalMB = pPageDict->GetRectFor("MediaBox"); if (pPageDict->KeyExist("CropBox")) - rcOriginalMB = pPageDict->GetRectBy("CropBox"); + rcOriginalMB = pPageDict->GetRectFor("CropBox"); if (rcOriginalMB.IsEmpty()) { rcOriginalMB = CFX_FloatRect(0.0f, 0.0f, 612.0f, 792.0f); @@ -349,7 +349,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { : rcMerger.bottom; if (pPageDict->KeyExist("ArtBox")) - rcOriginalCB = pPageDict->GetRectBy("ArtBox"); + rcOriginalCB = pPageDict->GetRectFor("ArtBox"); else rcOriginalCB = rcOriginalMB; @@ -359,7 +359,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { pMediaBox->Add(new CPDF_Number(rcOriginalMB.bottom)); pMediaBox->Add(new CPDF_Number(rcOriginalMB.right)); pMediaBox->Add(new CPDF_Number(rcOriginalMB.top)); - pPageDict->SetAt("MediaBox", pMediaBox); + pPageDict->SetFor("MediaBox", pMediaBox); } if (!rcOriginalCB.IsEmpty()) { @@ -368,21 +368,21 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { pCropBox->Add(new CPDF_Number(rcOriginalCB.bottom)); pCropBox->Add(new CPDF_Number(rcOriginalCB.right)); pCropBox->Add(new CPDF_Number(rcOriginalCB.top)); - pPageDict->SetAt("ArtBox", pCropBox); + pPageDict->SetFor("ArtBox", pCropBox); } - CPDF_Dictionary* pRes = pPageDict->GetDictBy("Resources"); + CPDF_Dictionary* pRes = pPageDict->GetDictFor("Resources"); if (!pRes) { pRes = new CPDF_Dictionary; - pPageDict->SetAt("Resources", pRes); + pPageDict->SetFor("Resources", pRes); } CPDF_Stream* pNewXObject = new CPDF_Stream(nullptr, 0, new CPDF_Dictionary); uint32_t dwObjNum = pDocument->AddIndirectObject(pNewXObject); - CPDF_Dictionary* pPageXObject = pRes->GetDictBy("XObject"); + CPDF_Dictionary* pPageXObject = pRes->GetDictFor("XObject"); if (!pPageXObject) { pPageXObject = new CPDF_Dictionary; - pRes->SetAt("XObject", pPageXObject); + pRes->SetFor("XObject", pPageXObject); } CFX_ByteString key = ""; @@ -403,16 +403,16 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { CPDF_Dictionary* pNewXORes = nullptr; if (!key.IsEmpty()) { - pPageXObject->SetAtReference(key, pDocument, dwObjNum); + pPageXObject->SetReferenceFor(key, pDocument, dwObjNum); CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict(); pNewXORes = new CPDF_Dictionary; - pNewOXbjectDic->SetAt("Resources", pNewXORes); - pNewOXbjectDic->SetAtName("Type", "XObject"); - pNewOXbjectDic->SetAtName("Subtype", "Form"); - pNewOXbjectDic->SetAtInteger("FormType", 1); - pNewOXbjectDic->SetAtName("Name", "FRM"); - CFX_FloatRect rcBBox = pPageDict->GetRectBy("ArtBox"); - pNewOXbjectDic->SetAtRect("BBox", rcBBox); + pNewOXbjectDic->SetFor("Resources", pNewXORes); + pNewOXbjectDic->SetNameFor("Type", "XObject"); + pNewOXbjectDic->SetNameFor("Subtype", "Form"); + pNewOXbjectDic->SetIntegerFor("FormType", 1); + pNewOXbjectDic->SetNameFor("Name", "FRM"); + CFX_FloatRect rcBBox = pPageDict->GetRectFor("ArtBox"); + pNewOXbjectDic->SetRectFor("BBox", rcBBox); } for (int i = 0; i < nStreams; i++) { @@ -420,22 +420,22 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { if (!pAnnotDic) continue; - CFX_FloatRect rcAnnot = pAnnotDic->GetRectBy("Rect"); + CFX_FloatRect rcAnnot = pAnnotDic->GetRectFor("Rect"); rcAnnot.Normalize(); - CFX_ByteString sAnnotState = pAnnotDic->GetStringBy("AS"); - CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDictBy("AP"); + CFX_ByteString sAnnotState = pAnnotDic->GetStringFor("AS"); + CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDictFor("AP"); if (!pAnnotAP) continue; - CPDF_Stream* pAPStream = pAnnotAP->GetStreamBy("N"); + CPDF_Stream* pAPStream = pAnnotAP->GetStreamFor("N"); if (!pAPStream) { - CPDF_Dictionary* pAPDic = pAnnotAP->GetDictBy("N"); + CPDF_Dictionary* pAPDic = pAnnotAP->GetDictFor("N"); if (!pAPDic) continue; if (!sAnnotState.IsEmpty()) { - pAPStream = pAPDic->GetStreamBy(sAnnotState); + pAPStream = pAPDic->GetStreamFor(sAnnotState); } else { auto it = pAPDic->begin(); if (it != pAPDic->end()) { @@ -454,13 +454,13 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { continue; CPDF_Dictionary* pAPDic = pAPStream->GetDict(); - CFX_Matrix matrix = pAPDic->GetMatrixBy("Matrix"); + CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix"); CFX_FloatRect rcStream; if (pAPDic->KeyExist("Rect")) - rcStream = pAPDic->GetRectBy("Rect"); + rcStream = pAPDic->GetRectFor("Rect"); else if (pAPDic->KeyExist("BBox")) - rcStream = pAPDic->GetRectBy("BBox"); + rcStream = pAPDic->GetRectFor("BBox"); if (rcStream.IsEmpty()) continue; @@ -470,21 +470,21 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { if (pObj) { CPDF_Dictionary* pObjDic = pObj->GetDict(); if (pObjDic) { - pObjDic->SetAtName("Type", "XObject"); - pObjDic->SetAtName("Subtype", "Form"); + pObjDic->SetNameFor("Type", "XObject"); + pObjDic->SetNameFor("Subtype", "Form"); } } - CPDF_Dictionary* pXObject = pNewXORes->GetDictBy("XObject"); + CPDF_Dictionary* pXObject = pNewXORes->GetDictFor("XObject"); if (!pXObject) { pXObject = new CPDF_Dictionary; - pNewXORes->SetAt("XObject", pXObject); + pNewXORes->SetFor("XObject", pXObject); } CFX_ByteString sFormName; sFormName.Format("F%d", i); uint32_t dwStreamObjNum = pDocument->AddIndirectObject(pObj); - pXObject->SetAtReference(sFormName, pDocument, dwStreamObjNum); + pXObject->SetReferenceFor(sFormName, pDocument, dwStreamObjNum); CPDF_StreamAcc acc; acc.LoadAllData(pNewXObject); @@ -508,7 +508,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { sStream += sTemp; pNewXObject->SetData(sStream.raw_str(), sStream.GetLength(), FALSE, FALSE); } - pPageDict->RemoveAt("Annots"); + pPageDict->RemoveFor("Annots"); ObjectArray.RemoveAll(); RectArray.RemoveAll(); diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index c77ece7b9d..7b2bf73871 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -31,7 +31,7 @@ void SetBoundingBox(CPDF_Page* page, pBoundingBoxArray->Add(new CPDF_Number(bottom)); pBoundingBoxArray->Add(new CPDF_Number(right)); pBoundingBoxArray->Add(new CPDF_Number(top)); - page->m_pFormDict->SetAt(key, pBoundingBoxArray); + page->m_pFormDict->SetFor(key, pBoundingBoxArray); } bool GetBoundingBox(CPDF_Page* page, @@ -40,7 +40,7 @@ bool GetBoundingBox(CPDF_Page* page, float* bottom, float* right, float* top) { - CPDF_Array* pArray = page->m_pFormDict->GetArrayBy(key); + CPDF_Array* pArray = page->m_pFormDict->GetArrayFor(key); if (!pArray) return false; @@ -119,9 +119,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, CPDF_Dictionary* pPageDic = pPage->m_pFormDict; CPDF_Object* pContentObj = - pPageDic ? pPageDic->GetObjectBy("Contents") : nullptr; + pPageDic ? pPageDic->GetObjectFor("Contents") : nullptr; if (!pContentObj) - pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; + pContentObj = pPageDic ? pPageDic->GetArrayFor("Contents") : nullptr; if (!pContentObj) return FALSE; @@ -159,16 +159,16 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, pContentArray->AddReference(pDoc, pStream->GetObjNum()); pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); pContentArray->AddReference(pDoc, pEndStream); - pPageDic->SetAtReference("Contents", pDoc, - pDoc->AddIndirectObject(pContentArray)); + pPageDic->SetReferenceFor("Contents", pDoc, + pDoc->AddIndirectObject(pContentArray)); } } } // Need to transform the patterns as well. - CPDF_Dictionary* pRes = pPageDic->GetDictBy("Resources"); + CPDF_Dictionary* pRes = pPageDic->GetDictFor("Resources"); if (pRes) { - CPDF_Dictionary* pPattenDict = pRes->GetDictBy("Pattern"); + CPDF_Dictionary* pPattenDict = pRes->GetDictFor("Pattern"); if (pPattenDict) { for (const auto& it : *pPattenDict) { CPDF_Object* pObj = it.second; @@ -183,10 +183,10 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, else continue; - CFX_Matrix m = pDict->GetMatrixBy("Matrix"); + CFX_Matrix m = pDict->GetMatrixFor("Matrix"); CFX_Matrix t = *(CFX_Matrix*)matrix; m.Concat(t); - pDict->SetAtMatrix("Matrix", m); + pDict->SetMatrixFor("Matrix", m); } } } @@ -277,9 +277,9 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, CPDF_Dictionary* pPageDic = pPage->m_pFormDict; CPDF_Object* pContentObj = - pPageDic ? pPageDic->GetObjectBy("Contents") : nullptr; + pPageDic ? pPageDic->GetObjectFor("Contents") : nullptr; if (!pContentObj) - pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr; + pContentObj = pPageDic ? pPageDic->GetArrayFor("Contents") : nullptr; if (!pContentObj) return; @@ -326,8 +326,8 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, pContentArray = new CPDF_Array(); pContentArray->AddReference(pDoc, pStream->GetObjNum()); pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); - pPageDic->SetAtReference("Contents", pDoc, - pDoc->AddIndirectObject(pContentArray)); + pPageDic->SetReferenceFor("Contents", pDoc, + pDoc->AddIndirectObject(pContentArray)); } } } diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index de80c4c773..f22f73743e 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -276,7 +276,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage || !pPage->m_pFormDict) return FALSE; - CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots"); + CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayFor("Annots"); if (!pAnnots) return FALSE; for (size_t i = *startPos; i < pAnnots->GetCount(); i++) { @@ -284,7 +284,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetDirectObjectAt(i))); if (!pDict) continue; - if (pDict->GetStringBy("Subtype") == "Link") { + if (pDict->GetStringFor("Subtype") == "Link") { *startPos = static_cast<int>(i + 1); *linkAnnot = static_cast<FPDF_LINK>(pDict); return TRUE; @@ -299,7 +299,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, return FALSE; CPDF_Dictionary* pAnnotDict = ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); - CFX_FloatRect rt = pAnnotDict->GetRectBy("Rect"); + CFX_FloatRect rt = pAnnotDict->GetRectFor("Rect"); rect->left = rt.left; rect->bottom = rt.bottom; rect->right = rt.right; @@ -312,7 +312,7 @@ DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) { return 0; CPDF_Dictionary* pAnnotDict = ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); - CPDF_Array* pArray = pAnnotDict->GetArrayBy("QuadPoints"); + CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints"); if (!pArray) return 0; return static_cast<int>(pArray->GetCount() / 8); @@ -325,7 +325,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, return FALSE; CPDF_Dictionary* pAnnotDict = ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); - CPDF_Array* pArray = pAnnotDict->GetArrayBy("QuadPoints"); + CPDF_Array* pArray = pAnnotDict->GetArrayFor("QuadPoints"); if (pArray) { if (quadIndex < 0 || static_cast<size_t>(quadIndex) >= pArray->GetCount() / 8 || @@ -356,7 +356,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, CPDF_Dictionary* pInfo = pDoc->GetInfo(); if (!pInfo) return 0; - CFX_WideString text = pInfo->GetUnicodeTextBy(tag); + CFX_WideString text = pInfo->GetUnicodeTextFor(tag); // Use UTF-16LE encoding CFX_ByteString encodedText = text.UTF16LE_Encode(); unsigned long len = encodedText.GetLength(); diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp index a555e961f3..5bda8da928 100644 --- a/fpdfsdk/fpdfdoc_unittest.cpp +++ b/fpdfsdk/fpdfdoc_unittest.cpp @@ -104,7 +104,7 @@ TEST_F(PDFDocTest, FindBookmark) { } { // Empty bookmark tree. - m_pRootObj->SetAt("Outlines", new CPDF_Dictionary()); + m_pRootObj->SetFor("Outlines", new CPDF_Dictionary()); std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = GetFPDFWideString(L""); EXPECT_EQ(nullptr, FPDFBookmark_Find(m_pDoc.get(), title.get())); @@ -116,27 +116,27 @@ TEST_F(PDFDocTest, FindBookmark) { // Check on a regular bookmark tree. auto bookmarks = CreateDictObjs(3); - bookmarks[1].obj->SetAt("Title", new CPDF_String(L"Chapter 1")); - bookmarks[1].obj->SetAt( + bookmarks[1].obj->SetFor("Title", new CPDF_String(L"Chapter 1")); + bookmarks[1].obj->SetFor( "Parent", new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); - bookmarks[1].obj->SetAt( + bookmarks[1].obj->SetFor( "Next", new CPDF_Reference(m_pIndirectObjs, bookmarks[2].num)); - bookmarks[2].obj->SetAt("Title", new CPDF_String(L"Chapter 2")); - bookmarks[2].obj->SetAt( + bookmarks[2].obj->SetFor("Title", new CPDF_String(L"Chapter 2")); + bookmarks[2].obj->SetFor( "Parent", new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); - bookmarks[2].obj->SetAt( + bookmarks[2].obj->SetFor( "Prev", new CPDF_Reference(m_pIndirectObjs, bookmarks[1].num)); - bookmarks[0].obj->SetAt("Type", new CPDF_Name("Outlines")); - bookmarks[0].obj->SetAt("Count", new CPDF_Number(2)); - bookmarks[0].obj->SetAt( + bookmarks[0].obj->SetFor("Type", new CPDF_Name("Outlines")); + bookmarks[0].obj->SetFor("Count", new CPDF_Number(2)); + bookmarks[0].obj->SetFor( "First", new CPDF_Reference(m_pIndirectObjs, bookmarks[1].num)); - bookmarks[0].obj->SetAt( + bookmarks[0].obj->SetFor( "Last", new CPDF_Reference(m_pIndirectObjs, bookmarks[2].num)); - m_pRootObj->SetAt("Outlines", - new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); + m_pRootObj->SetFor("Outlines", + new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); // Title with no match. std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = @@ -159,27 +159,27 @@ TEST_F(PDFDocTest, FindBookmark) { // Circular bookmarks in depth. auto bookmarks = CreateDictObjs(3); - bookmarks[1].obj->SetAt("Title", new CPDF_String(L"Chapter 1")); - bookmarks[1].obj->SetAt( + bookmarks[1].obj->SetFor("Title", new CPDF_String(L"Chapter 1")); + bookmarks[1].obj->SetFor( "Parent", new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); - bookmarks[1].obj->SetAt( + bookmarks[1].obj->SetFor( "First", new CPDF_Reference(m_pIndirectObjs, bookmarks[2].num)); - bookmarks[2].obj->SetAt("Title", new CPDF_String(L"Chapter 2")); - bookmarks[2].obj->SetAt( + bookmarks[2].obj->SetFor("Title", new CPDF_String(L"Chapter 2")); + bookmarks[2].obj->SetFor( "Parent", new CPDF_Reference(m_pIndirectObjs, bookmarks[1].num)); - bookmarks[2].obj->SetAt( + bookmarks[2].obj->SetFor( "First", new CPDF_Reference(m_pIndirectObjs, bookmarks[1].num)); - bookmarks[0].obj->SetAt("Type", new CPDF_Name("Outlines")); - bookmarks[0].obj->SetAt("Count", new CPDF_Number(2)); - bookmarks[0].obj->SetAt( + bookmarks[0].obj->SetFor("Type", new CPDF_Name("Outlines")); + bookmarks[0].obj->SetFor("Count", new CPDF_Number(2)); + bookmarks[0].obj->SetFor( "First", new CPDF_Reference(m_pIndirectObjs, bookmarks[1].num)); - bookmarks[0].obj->SetAt( + bookmarks[0].obj->SetFor( "Last", new CPDF_Reference(m_pIndirectObjs, bookmarks[2].num)); - m_pRootObj->SetAt("Outlines", - new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); + m_pRootObj->SetFor("Outlines", + new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); // Title with no match. std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = @@ -194,33 +194,33 @@ TEST_F(PDFDocTest, FindBookmark) { // Circular bookmarks in breadth. auto bookmarks = CreateDictObjs(4); - bookmarks[1].obj->SetAt("Title", new CPDF_String(L"Chapter 1")); - bookmarks[1].obj->SetAt( + bookmarks[1].obj->SetFor("Title", new CPDF_String(L"Chapter 1")); + bookmarks[1].obj->SetFor( "Parent", new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); - bookmarks[1].obj->SetAt( + bookmarks[1].obj->SetFor( "Next", new CPDF_Reference(m_pIndirectObjs, bookmarks[2].num)); - bookmarks[2].obj->SetAt("Title", new CPDF_String(L"Chapter 2")); - bookmarks[2].obj->SetAt( + bookmarks[2].obj->SetFor("Title", new CPDF_String(L"Chapter 2")); + bookmarks[2].obj->SetFor( "Parent", new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); - bookmarks[2].obj->SetAt( + bookmarks[2].obj->SetFor( "Next", new CPDF_Reference(m_pIndirectObjs, bookmarks[3].num)); - bookmarks[3].obj->SetAt("Title", new CPDF_String(L"Chapter 3")); - bookmarks[3].obj->SetAt( + bookmarks[3].obj->SetFor("Title", new CPDF_String(L"Chapter 3")); + bookmarks[3].obj->SetFor( "Parent", new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); - bookmarks[3].obj->SetAt( + bookmarks[3].obj->SetFor( "Next", new CPDF_Reference(m_pIndirectObjs, bookmarks[1].num)); - bookmarks[0].obj->SetAt("Type", new CPDF_Name("Outlines")); - bookmarks[0].obj->SetAt("Count", new CPDF_Number(2)); - bookmarks[0].obj->SetAt( + bookmarks[0].obj->SetFor("Type", new CPDF_Name("Outlines")); + bookmarks[0].obj->SetFor("Count", new CPDF_Number(2)); + bookmarks[0].obj->SetFor( "First", new CPDF_Reference(m_pIndirectObjs, bookmarks[1].num)); - bookmarks[0].obj->SetAt( + bookmarks[0].obj->SetFor( "Last", new CPDF_Reference(m_pIndirectObjs, bookmarks[2].num)); - m_pRootObj->SetAt("Outlines", - new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); + m_pRootObj->SetFor("Outlines", + new CPDF_Reference(m_pIndirectObjs, bookmarks[0].num)); // Title with no match. std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 0b677be691..e3777d4f84 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -57,7 +57,7 @@ bool IsPageObject(CPDF_Page* pPage) { if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type")) return false; - CPDF_Object* pObject = pPage->m_pFormDict->GetObjectBy("Type")->GetDirect(); + CPDF_Object* pObject = pPage->m_pFormDict->GetObjectFor("Type")->GetDirect(); return pObject && !pObject->GetString().Compare("Page"); } @@ -85,8 +85,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() { pInfoDict = pDoc->GetInfo(); if (pInfoDict) { if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) - pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr, FALSE)); - pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium")); + pInfoDict->SetFor("CreationDate", new CPDF_String(DateStr, FALSE)); + pInfoDict->SetFor("Creator", new CPDF_String(L"PDFium")); } return FPDFDocumentFromCPDFDocument(pDoc); @@ -116,9 +116,9 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width))); pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height))); - pPageDict->SetAt("MediaBox", pMediaBoxArray); - pPageDict->SetAt("Rotate", new CPDF_Number(0)); - pPageDict->SetAt("Resources", new CPDF_Dictionary); + pPageDict->SetFor("MediaBox", pMediaBoxArray); + pPageDict->SetFor("Rotate", new CPDF_Number(0)); + pPageDict->SetFor("Resources", new CPDF_Dictionary); #ifdef PDF_ENABLE_XFA CPDFXFA_Page* pPage = @@ -140,13 +140,13 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { CPDF_Dictionary* pDict = pPage->m_pFormDict; while (pDict) { if (pDict->KeyExist("Rotate")) { - CPDF_Object* pRotateObj = pDict->GetObjectBy("Rotate")->GetDirect(); + CPDF_Object* pRotateObj = pDict->GetObjectFor("Rotate")->GetDirect(); return pRotateObj ? pRotateObj->GetInteger() / 90 : 0; } if (!pDict->KeyExist("Parent")) break; - pDict = ToDictionary(pDict->GetObjectBy("Parent")->GetDirect()); + pDict = ToDictionary(pDict->GetObjectFor("Parent")->GetDirect()); } return 0; @@ -294,14 +294,14 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, (FX_FLOAT)e, (FX_FLOAT)f); rect.Transform(&matrix); - CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect"); + CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayFor("Rect"); if (!pRectArray) pRectArray = new CPDF_Array; pRectArray->SetAt(0, new CPDF_Number(rect.left)); pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); pRectArray->SetAt(2, new CPDF_Number(rect.right)); pRectArray->SetAt(3, new CPDF_Number(rect.top)); - pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); + pAnnot->GetAnnotDict()->SetFor("Rect", pRectArray); // Transform AP's rectangle // To Do @@ -315,5 +315,5 @@ DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { CPDF_Dictionary* pDict = pPage->m_pFormDict; rotate %= 4; - pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); + pDict->SetFor("Rotate", new CPDF_Number(rotate * 90)); } diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index bf44b5ea55..7e4ce36f5f 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -685,7 +685,7 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, if (!pDic) return; - CPDF_AAction aa(pDic->GetDictBy("AA")); + CPDF_AAction aa(pDic->GetDictFor("AA")); if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) { CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType); CPDFSDK_ActionHandler* pActionHandler = @@ -716,7 +716,7 @@ DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, CPDFSDK_Environment* pEnv = pSDKDoc->GetEnv(); CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; - CPDF_AAction aa(pPageDict->GetDictBy("AA")); + CPDF_AAction aa(pPageDict->GetDictFor("AA")); if (FPDFPAGE_AACTION_OPEN == aaType) { if (aa.ActionExist(CPDF_AAction::OpenPage)) { CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index 3432fb6e6e..8ed8384c24 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -60,33 +60,33 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, CFX_ByteString producerstr; producerstr.Format("PDFium"); - DInfoDict->SetAt("Producer", new CPDF_String(producerstr, FALSE)); + DInfoDict->SetFor("Producer", new CPDF_String(producerstr, FALSE)); - CFX_ByteString cbRootType = pNewRoot->GetStringBy("Type", ""); + CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", ""); if (cbRootType.IsEmpty()) - pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); + pNewRoot->SetFor("Type", new CPDF_Name("Catalog")); - CPDF_Object* pElement = pNewRoot->GetObjectBy("Pages"); + CPDF_Object* pElement = pNewRoot->GetObjectFor("Pages"); CPDF_Dictionary* pNewPages = pElement ? ToDictionary(pElement->GetDirect()) : nullptr; if (!pNewPages) { pNewPages = new CPDF_Dictionary; uint32_t NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); - pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON)); + pNewRoot->SetFor("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON)); } - CFX_ByteString cbPageType = pNewPages->GetStringBy("Type", ""); + CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", ""); if (cbPageType == "") { - pNewPages->SetAt("Type", new CPDF_Name("Pages")); + pNewPages->SetFor("Type", new CPDF_Name("Pages")); } - CPDF_Array* pKeysArray = pNewPages->GetArrayBy("Kids"); + CPDF_Array* pKeysArray = pNewPages->GetArrayFor("Kids"); if (!pKeysArray) { CPDF_Array* pNewKids = new CPDF_Array; uint32_t Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids); - pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum)); - pNewPages->SetAt("Count", new CPDF_Number(0)); + pNewPages->SetFor("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum)); + pNewPages->SetFor("Count", new CPDF_Number(0)); } return TRUE; @@ -111,8 +111,8 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, CPDF_Object* pObj = it.second; if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) { if (pCurPageDict->KeyExist(cbSrcKeyStr)) - pCurPageDict->RemoveAt(cbSrcKeyStr); - pCurPageDict->SetAt(cbSrcKeyStr, pObj->Clone()); + pCurPageDict->RemoveFor(cbSrcKeyStr); + pCurPageDict->SetFor(cbSrcKeyStr, pObj->Clone()); } } @@ -126,7 +126,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, // if not exists,we take the letter size. pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox"); if (pInheritable) { - pCurPageDict->SetAt("MediaBox", pInheritable->Clone()); + pCurPageDict->SetFor("MediaBox", pInheritable->Clone()); } else { // Make the default size to be letter size (8.5'x11') CPDF_Array* pArray = new CPDF_Array; @@ -134,10 +134,10 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, pArray->AddNumber(0); pArray->AddNumber(612); pArray->AddNumber(792); - pCurPageDict->SetAt("MediaBox", pArray); + pCurPageDict->SetFor("MediaBox", pArray); } } else { - pCurPageDict->SetAt("MediaBox", pInheritable->Clone()); + pCurPageDict->SetFor("MediaBox", pInheritable->Clone()); } } // 2 Resources //required @@ -145,19 +145,19 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc, pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources"); if (!pInheritable) return FALSE; - pCurPageDict->SetAt("Resources", pInheritable->Clone()); + pCurPageDict->SetFor("Resources", pInheritable->Clone()); } // 3 CropBox //Optional if (!pCurPageDict->KeyExist("CropBox")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox"); if (pInheritable) - pCurPageDict->SetAt("CropBox", pInheritable->Clone()); + pCurPageDict->SetFor("CropBox", pInheritable->Clone()); } // 4 Rotate //Optional if (!pCurPageDict->KeyExist("Rotate")) { pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Rotate"); if (pInheritable) - pCurPageDict->SetAt("Rotate", pInheritable->Clone()); + pCurPageDict->SetFor("Rotate", pInheritable->Clone()); } // Update the reference @@ -181,25 +181,26 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type")) return nullptr; - CPDF_Object* pType = pDict->GetObjectBy("Type")->GetDirect(); + CPDF_Object* pType = pDict->GetObjectFor("Type")->GetDirect(); if (!ToName(pType)) return nullptr; if (pType->GetString().Compare("Page")) return nullptr; - CPDF_Dictionary* pp = ToDictionary(pDict->GetObjectBy("Parent")->GetDirect()); + CPDF_Dictionary* pp = + ToDictionary(pDict->GetObjectFor("Parent")->GetDirect()); if (!pp) return nullptr; if (pDict->KeyExist(bsSrcTag)) - return pDict->GetObjectBy(bsSrcTag); + return pDict->GetObjectFor(bsSrcTag); while (pp) { if (pp->KeyExist(bsSrcTag)) - return pp->GetObjectBy(bsSrcTag); + return pp->GetObjectFor(bsSrcTag); if (!pp->KeyExist("Parent")) break; - pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect()); + pp = ToDictionary(pp->GetObjectFor("Parent")->GetDirect()); } return nullptr; } @@ -228,7 +229,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, if (!pNextObj) return FALSE; if (!UpdateReference(pNextObj, pDoc, pObjNumberMap)) - pDict->RemoveAt(key); + pDict->RemoveFor(key); } break; } @@ -285,7 +286,7 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc, if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) { if (pDictClone->KeyExist("Type")) { - CFX_ByteString strType = pDictClone->GetStringBy("Type"); + CFX_ByteString strType = pDictClone->GetStringFor("Type"); if (!FXSYS_stricmp(strType.c_str(), "Pages")) { pDictClone->Release(); return 4; @@ -394,7 +395,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, return FALSE; CPDF_Dictionary* pSrcDict = pSrcDoc->GetRoot(); - pSrcDict = pSrcDict->GetDictBy("ViewerPreferences"); + pSrcDict = pSrcDict->GetDictFor("ViewerPreferences"); if (!pSrcDict) return FALSE; @@ -402,6 +403,6 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, if (!pDstDict) return FALSE; - pDstDict->SetAt("ViewerPreferences", pSrcDict->CloneDirectObject()); + pDstDict->SetFor("ViewerPreferences", pSrcDict->CloneDirectObject()); return TRUE; } diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 81cc913004..243ba2a817 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -100,11 +100,11 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, if (!pRoot) return false; - CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); + CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); if (!pAcroForm) return false; - CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); + CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA"); if (!pXFA) return true; diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 76540fc283..9f3ca0f9e8 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -396,15 +396,15 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, if (!pRoot) return FALSE; - CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); + CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); if (!pAcroForm) return FALSE; - CPDF_Object* pXFA = pAcroForm->GetObjectBy("XFA"); + CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA"); if (!pXFA) return FALSE; - bool bDynamicXFA = pRoot->GetBooleanBy("NeedsRendering", false); + bool bDynamicXFA = pRoot->GetBooleanFor("NeedsRendering", false); *docType = bDynamicXFA ? DOCTYPE_DYNAMIC_XFA : DOCTYPE_STATIC_XFA; return TRUE; } @@ -519,7 +519,7 @@ DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) { return -1; CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict(); - return pDict ? pDict->GetIntegerBy("R") : -1; + return pDict ? pDict->GetIntegerFor("R") : -1; } DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document) { @@ -991,7 +991,7 @@ DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document) { CPDF_NameTree nameTree(pDoc, "Dests"); pdfium::base::CheckedNumeric<FPDF_DWORD> count = nameTree.GetCount(); - CPDF_Dictionary* pDest = pRoot->GetDictBy("Dests"); + CPDF_Dictionary* pDest = pRoot->GetDictFor("Dests"); if (pDest) count += pDest->GetCount(); @@ -1090,7 +1090,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, CPDF_NameTree nameTree(pDoc, "Dests"); int count = nameTree.GetCount(); if (index >= count) { - CPDF_Dictionary* pDest = pRoot->GetDictBy("Dests"); + CPDF_Dictionary* pDest = pRoot->GetDictFor("Dests"); if (!pDest) return nullptr; @@ -1116,7 +1116,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, if (!pDestObj) return nullptr; if (CPDF_Dictionary* pDict = pDestObj->AsDictionary()) { - pDestObj = pDict->GetArrayBy("D"); + pDestObj = pDict->GetArrayFor("D"); if (!pDestObj) return nullptr; } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 17e94ff8e2..3bf116e64a 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -386,7 +386,7 @@ void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, if (!pInfoDict) return; - CFX_ByteString csTitle = pInfoDict->GetStringBy("Title"); + CFX_ByteString csTitle = pInfoDict->GetStringFor("Title"); wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); csTitle.ReleaseBuffer(csTitle.GetLength()); } @@ -397,7 +397,7 @@ void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, return; if (CPDF_Dictionary* pInfoDict = m_pDocument->GetPDFDoc()->GetInfo()) - pInfoDict->SetAt("Title", new CPDF_String(wsTitle)); + pInfoDict->SetFor("Title", new CPDF_String(wsTitle)); } void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, @@ -447,11 +447,11 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, if (!pRoot) return; - CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); + CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); if (!pAcroForm) return; - CPDF_Array* pArray = ToArray(pAcroForm->GetObjectBy("XFA")); + CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA")); if (!pArray) return; @@ -748,13 +748,13 @@ FX_BOOL CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, return FALSE; } - CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); + CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); if (!pAcroForm) { fileStream.Flush(); return FALSE; } - CPDF_Array* pArray = ToArray(pAcroForm->GetObjectBy("XFA")); + CPDF_Array* pArray = ToArray(pAcroForm->GetObjectFor("XFA")); if (!pArray) { fileStream.Flush(); return FALSE; diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index d1b6148776..8935037ec8 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -784,15 +784,16 @@ FX_BOOL Document::info(IJS_Context* cc, if (!pDictionary) return FALSE; - CFX_WideString cwAuthor = pDictionary->GetUnicodeTextBy("Author"); - CFX_WideString cwTitle = pDictionary->GetUnicodeTextBy("Title"); - CFX_WideString cwSubject = pDictionary->GetUnicodeTextBy("Subject"); - CFX_WideString cwKeywords = pDictionary->GetUnicodeTextBy("Keywords"); - CFX_WideString cwCreator = pDictionary->GetUnicodeTextBy("Creator"); - CFX_WideString cwProducer = pDictionary->GetUnicodeTextBy("Producer"); - CFX_WideString cwCreationDate = pDictionary->GetUnicodeTextBy("CreationDate"); - CFX_WideString cwModDate = pDictionary->GetUnicodeTextBy("ModDate"); - CFX_WideString cwTrapped = pDictionary->GetUnicodeTextBy("Trapped"); + CFX_WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author"); + CFX_WideString cwTitle = pDictionary->GetUnicodeTextFor("Title"); + CFX_WideString cwSubject = pDictionary->GetUnicodeTextFor("Subject"); + CFX_WideString cwKeywords = pDictionary->GetUnicodeTextFor("Keywords"); + CFX_WideString cwCreator = pDictionary->GetUnicodeTextFor("Creator"); + CFX_WideString cwProducer = pDictionary->GetUnicodeTextFor("Producer"); + CFX_WideString cwCreationDate = + pDictionary->GetUnicodeTextFor("CreationDate"); + CFX_WideString cwModDate = pDictionary->GetUnicodeTextFor("ModDate"); + CFX_WideString cwTrapped = pDictionary->GetUnicodeTextFor("Trapped"); CJS_Context* pContext = (CJS_Context*)cc; CJS_Runtime* pRuntime = pContext->GetJSRuntime(); @@ -838,7 +839,7 @@ FX_BOOL Document::getPropertyInternal(IJS_Context* cc, return FALSE; if (vp.IsGetting()) { - vp << pDictionary->GetUnicodeTextBy(propName); + vp << pDictionary->GetUnicodeTextFor(propName); } else { if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) { sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); @@ -846,7 +847,7 @@ FX_BOOL Document::getPropertyInternal(IJS_Context* cc, } CFX_WideString csProperty; vp >> csProperty; - pDictionary->SetAtString(propName, PDF_EncodeText(csProperty)); + pDictionary->SetStringFor(propName, PDF_EncodeText(csProperty)); m_pDocument->SetChangeMark(); } return TRUE; diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index 6689aa644e..65dde8c76e 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -63,7 +63,7 @@ void CPWL_Image::GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { if (m_pPDFStream) { if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { - CFX_FloatRect rect = pDict->GetRectBy("BBox"); + CFX_FloatRect rect = pDict->GetRectFor("BBox"); fWidth = rect.right - rect.left; fHeight = rect.top - rect.bottom; @@ -74,7 +74,7 @@ void CPWL_Image::GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { CFX_Matrix CPWL_Image::GetImageMatrix() { if (m_pPDFStream) { if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { - return pDict->GetMatrixBy("Matrix"); + return pDict->GetMatrixFor("Matrix"); } } @@ -87,7 +87,7 @@ CFX_ByteString CPWL_Image::GetImageAlias() { if (m_pPDFStream) { if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) { - return pDict->GetStringBy("Name"); + return pDict->GetStringFor("Name"); } } @@ -135,7 +135,7 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { fLeft = 0.0f; fBottom = 0.0f; CPDF_Array* pA = m_pIconFit->GetDict() - ? m_pIconFit->GetDict()->GetArrayBy("A") + ? m_pIconFit->GetDict()->GetArrayFor("A") : nullptr; if (pA) { size_t dwCount = pA->GetCount(); |