diff options
Diffstat (limited to 'core/fpdfapi/fpdf_edit')
-rw-r--r-- | core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp | 26 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 25 |
2 files changed, 26 insertions, 25 deletions
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp index 0e4bab1ae1..d3d55b91b5 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -49,14 +49,14 @@ void CPDF_PageContentGenerator::GenerateContent() { ProcessImage(buf, pPageObj->AsImage()); } CPDF_Object* pContent = - pPageDict ? pPageDict->GetDirectObjectBy("Contents") : nullptr; + pPageDict ? pPageDict->GetDirectObjectFor("Contents") : nullptr; if (pContent) { - pPageDict->RemoveAt("Contents"); + pPageDict->RemoveFor("Contents"); } CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); m_pDocument->AddIndirectObject(pStream); - pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); + pPageDict->SetReferenceFor("Contents", m_pDocument, pStream->GetObjNum()); } CFX_ByteString CPDF_PageContentGenerator::RealizeResource( @@ -65,12 +65,12 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource( if (!m_pPage->m_pResources) { m_pPage->m_pResources = new CPDF_Dictionary; int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); - m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); + m_pPage->m_pFormDict->SetReferenceFor("Resources", m_pDocument, objnum); } - CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(bsType); + CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictFor(bsType); if (!pResList) { pResList = new CPDF_Dictionary; - m_pPage->m_pResources->SetAt(bsType, pResList); + m_pPage->m_pResources->SetFor(bsType, pResList); } m_pDocument->AddIndirectObject(pResourceObj); CFX_ByteString name; @@ -82,7 +82,7 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource( } idnum++; } - pResList->SetAtReference(name, m_pDocument, pResourceObj->GetObjNum()); + pResList->SetReferenceFor(name, m_pDocument, pResourceObj->GetObjNum()); return name; } @@ -114,11 +114,11 @@ void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, } CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); CPDF_Dictionary* pFormDict = new CPDF_Dictionary; - pFormDict->SetAtName("Type", "XObject"); - pFormDict->SetAtName("Subtype", "Form"); + pFormDict->SetNameFor("Type", "XObject"); + pFormDict->SetNameFor("Subtype", "Form"); CFX_FloatRect bbox = m_pPage->GetPageBBox(); matrix.TransformRect(bbox); - pFormDict->SetAtRect("BBox", bbox); + pFormDict->SetRectFor("BBox", bbox); pStream->InitStream(data, size, pFormDict); buf << "q " << matrix << " cm "; CFX_ByteString name = RealizeResource(pStream, "XObject"); @@ -127,7 +127,7 @@ void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { CPDF_Dictionary* pDict = m_pPage->m_pFormDict; CPDF_Object* pContent = - pDict ? pDict->GetDirectObjectBy("Contents") : nullptr; + pDict ? pDict->GetDirectObjectFor("Contents") : nullptr; if (!pContent) return; @@ -167,6 +167,6 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); m_pDocument->AddIndirectObject(pStream); - m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, - pStream->GetObjNum()); + m_pPage->m_pFormDict->SetReferenceFor("Contents", m_pDocument, + pStream->GetObjNum()); } diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 7ece85a602..cab99ecf7f 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -426,7 +426,7 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode) m_dwSize = destAcc.GetSize(); m_pData = (uint8_t*)destAcc.DetachData(); m_pDict = ToDictionary(pStream->GetDict()->Clone()); - m_pDict->RemoveAt("Filter"); + m_pDict->RemoveFor("Filter"); m_bNewData = TRUE; m_bCloned = TRUE; } else { @@ -442,9 +442,9 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, FX_BOOL bFlateEncode) // TODO(thestig): Move to Init() and check return value. ::FlateEncode(m_Acc.GetData(), m_Acc.GetSize(), &m_pData, &m_dwSize); m_pDict = ToDictionary(pStream->GetDict()->Clone()); - m_pDict->SetAtInteger("Length", m_dwSize); - m_pDict->SetAtName("Filter", "FlateDecode"); - m_pDict->RemoveAt("DecodeParms"); + m_pDict->SetIntegerFor("Length", m_dwSize); + m_pDict->SetNameFor("Filter", "FlateDecode"); + m_pDict->RemoveFor("DecodeParms"); } CPDF_FlateEncoder::CPDF_FlateEncoder(const uint8_t* pBuffer, @@ -923,7 +923,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { CPDF_Dictionary* pDict = pObj->GetDict(); if (pObj->IsStream()) { - if (pDict && pDict->GetStringBy("Type") == "XRef") + if (pDict && pDict->GetStringFor("Type") == "XRef") return 0; return 1; } @@ -933,7 +933,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { return 1; if (pDict->IsSignatureDict()) return 1; - if (pDict->GetStringBy("Type") == "Page") + if (pDict->GetStringFor("Type") == "Page") return 1; } @@ -993,9 +993,10 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, CPDF_FlateEncoder encoder(const_cast<CPDF_Stream*>(pStream->AsStream()), pStream != m_pMetadata); CPDF_Encryptor encryptor(pCrypto, objnum, encoder.m_pData, encoder.m_dwSize); - if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) { + if ((uint32_t)encoder.m_pDict->GetIntegerFor("Length") != + encryptor.m_dwSize) { encoder.CloneDict(); - encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize); + encoder.m_pDict->SetIntegerFor("Length", encryptor.m_dwSize); } if (WriteDirectObj(objnum, encoder.m_pDict) < 0) { return -1; @@ -1105,10 +1106,10 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum, TRUE); CPDF_Encryptor encryptor(m_pCryptoHandler, objnum, encoder.m_pData, encoder.m_dwSize); - if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") != + if ((uint32_t)encoder.m_pDict->GetIntegerFor("Length") != encryptor.m_dwSize) { encoder.CloneDict(); - encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize); + encoder.m_pDict->SetIntegerFor("Length", encryptor.m_dwSize); } if (WriteDirectObj(objnum, encoder.m_pDict) < 0) { return -1; @@ -1446,7 +1447,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { m_dwFlags &= ~FPDFCREATE_INCREMENTAL; } CPDF_Dictionary* pDict = m_pDocument->GetRoot(); - m_pMetadata = pDict ? pDict->GetDirectObjectBy("Metadata") : nullptr; + m_pMetadata = pDict ? pDict->GetDirectObjectFor("Metadata") : nullptr; if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) { m_pXRefStream.reset(new CPDF_XRefStream); m_pXRefStream->Start(); @@ -1959,7 +1960,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { } m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { - if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { + if (m_pEncryptDict->GetStringFor("Filter") == "Standard") { CFX_ByteString user_pass = m_pParser->GetPassword(); uint32_t flag = PDF_ENCRYPT_CONTENT; |