From 66a9dc9dd65ed2b9c7ede448d046b770140f16d5 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 26 Jan 2016 11:47:43 -0800 Subject: War on #defines, part 1. Make the two fundamental "object" types be enums. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1632143002 . --- fpdfsdk/src/fpdf_flatten.cpp | 7 +++---- fpdfsdk/src/fpdf_transformpage.cpp | 2 +- fpdfsdk/src/fpdfeditpage.cpp | 4 ++-- fpdfsdk/src/fpdfppo.cpp | 8 ++++---- fpdfsdk/src/javascript/Document.cpp | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index c81955d6ca..c59b6edc4d 100644 --- a/fpdfsdk/src/fpdf_flatten.cpp +++ b/fpdfsdk/src/fpdf_flatten.cpp @@ -207,11 +207,10 @@ void SetPageContents(CFX_ByteString key, return; } - int iType = pContentsObj->GetType(); CPDF_Array* pContentsArray = NULL; - switch (iType) { - case PDFOBJ_STREAM: { + switch (pContentsObj->GetType()) { + case CPDF_Object::STREAM: { pContentsArray = new CPDF_Array; CPDF_Stream* pContents = pContentsObj->AsStream(); FX_DWORD dwObjNum = pDocument->AddIndirectObject(pContents); @@ -227,7 +226,7 @@ void SetPageContents(CFX_ByteString key, break; } - case PDFOBJ_ARRAY: { + case CPDF_Object::ARRAY: { pContentsArray = pContentsObj->AsArray(); break; } diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp index 3e2c7b1151..a3074954a0 100644 --- a/fpdfsdk/src/fpdf_transformpage.cpp +++ b/fpdfsdk/src/fpdf_transformpage.cpp @@ -200,7 +200,7 @@ FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, // Special treatment to shading object, because the ClipPath for shading // object is already transformed. - if (pPageObj->m_Type != PDFPAGE_SHADING) + if (pPageObj->m_Type != CPDF_PageObject::SHADING) pPageObj->TransformClipPath(matrix); pPageObj->TransformGeneralState(matrix); } diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp index 0a44724f98..b9079a33c1 100644 --- a/fpdfsdk/src/fpdfeditpage.cpp +++ b/fpdfsdk/src/fpdfeditpage.cpp @@ -203,12 +203,12 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { if (pGeneralState && pGeneralState->m_FillAlpha != 1.0f) return TRUE; - if (pPageObj->m_Type == PDFPAGE_PATH) { + if (pPageObj->m_Type == CPDF_PageObject::PATH) { if (pGeneralState && pGeneralState->m_StrokeAlpha != 1.0f) return TRUE; } - if (pPageObj->m_Type == PDFPAGE_FORM) { + if (pPageObj->m_Type == CPDF_PageObject::FORM) { CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj; if (pFormObj->m_pForm && (pFormObj->m_pForm->m_Transparency & PDFTRANS_ISOLATED)) diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index 47b91015a9..895e360e8e 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -203,7 +203,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, CPDF_Document* pDoc, ObjectNumberMap* pObjNumberMap) { switch (pObj->GetType()) { - case PDFOBJ_REFERENCE: { + case CPDF_Object::REFERENCE: { CPDF_Reference* pReference = pObj->AsReference(); FX_DWORD newobjnum = GetNewObjId(pDoc, pObjNumberMap, pReference); if (newobjnum == 0) @@ -211,7 +211,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, pReference->SetRef(pDoc, newobjnum); break; } - case PDFOBJ_DICTIONARY: { + case CPDF_Object::DICTIONARY: { CPDF_Dictionary* pDict = pObj->AsDictionary(); auto it = pDict->begin(); while (it != pDict->end()) { @@ -231,7 +231,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, } break; } - case PDFOBJ_ARRAY: { + case CPDF_Object::ARRAY: { CPDF_Array* pArray = pObj->AsArray(); FX_DWORD count = pArray->GetCount(); for (FX_DWORD i = 0; i < count; ++i) { @@ -243,7 +243,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, } break; } - case PDFOBJ_STREAM: { + case CPDF_Object::STREAM: { CPDF_Stream* pStream = pObj->AsStream(); CPDF_Dictionary* pDict = pStream->GetDict(); if (pDict) { diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index ab733375ee..270330e5c0 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -1388,7 +1388,7 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc, while (pos) { if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) { - if (pPageObj->m_Type == PDFPAGE_TEXT) { + if (pPageObj->m_Type == CPDF_PageObject::TEXT) { int nObjWords = CountWords((CPDF_TextObject*)pPageObj); if (nWords + nObjWords >= nWordNo) { @@ -1447,7 +1447,7 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc, FX_POSITION pos = page.GetFirstObjectPosition(); while (pos) { if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) { - if (pPageObj->m_Type == PDFPAGE_TEXT) { + if (pPageObj->m_Type == CPDF_PageObject::TEXT) { CPDF_TextObject* pTextObj = (CPDF_TextObject*)pPageObj; nWords += CountWords(pTextObj); } -- cgit v1.2.3