summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_flatten.cpp
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 /fpdfsdk/fpdf_flatten.cpp
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 'fpdfsdk/fpdf_flatten.cpp')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp88
1 files changed, 44 insertions, 44 deletions
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();