summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/src/fpdf_flatten.cpp7
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp2
-rw-r--r--fpdfsdk/src/fpdfeditpage.cpp4
-rw-r--r--fpdfsdk/src/fpdfppo.cpp8
-rw-r--r--fpdfsdk/src/fpdfsave.cpp26
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp16
-rw-r--r--fpdfsdk/src/javascript/Document.cpp4
7 files changed, 32 insertions, 35 deletions
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 9149261018..521cc9fc83 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -216,12 +216,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/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index c1d21c8f72..c8bf5e767d 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -93,7 +93,7 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
CPDF_Object* pXFA = pAcroForm->GetElement("XFA");
if (pXFA == NULL)
return TRUE;
- if (pXFA->GetType() != PDFOBJ_ARRAY)
+ if (!pXFA->IsArray())
return FALSE;
CPDF_Array* pArray = pXFA->GetArray();
if (NULL == pArray)
@@ -105,7 +105,7 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
int iLast = size - 2;
for (int i = 0; i < size - 1; i++) {
CPDF_Object* pPDFObj = pArray->GetElement(i);
- if (pPDFObj->GetType() != PDFOBJ_STRING)
+ if (!pPDFObj->IsString())
continue;
if (pPDFObj->GetString() == "form")
iFormIndex = i + 1;
@@ -136,13 +136,12 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
if (iFormIndex != -1) {
// Get form CPDF_Stream
CPDF_Object* pFormPDFObj = pArray->GetElement(iFormIndex);
- if (pFormPDFObj->GetType() == PDFOBJ_REFERENCE) {
- CPDF_Object* pFormDircetObj = pFormPDFObj->GetDirect();
- if (NULL != pFormDircetObj &&
- pFormDircetObj->GetType() == PDFOBJ_STREAM) {
- pFormStream = (CPDF_Stream*)pFormDircetObj;
+ if (pFormPDFObj->IsReference()) {
+ CPDF_Object* pFormDirectObj = pFormPDFObj->GetDirect();
+ if (pFormDirectObj && pFormDirectObj->IsStream()) {
+ pFormStream = (CPDF_Stream*)pFormDirectObj;
}
- } else if (pFormPDFObj->GetType() == PDFOBJ_STREAM) {
+ } else if (pFormPDFObj->IsStream()) {
pFormStream = (CPDF_Stream*)pFormPDFObj;
}
}
@@ -150,14 +149,13 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
if (iDataSetsIndex != -1) {
// Get datasets CPDF_Stream
CPDF_Object* pDataSetsPDFObj = pArray->GetElement(iDataSetsIndex);
- if (pDataSetsPDFObj->GetType() == PDFOBJ_REFERENCE) {
+ if (pDataSetsPDFObj->IsReference()) {
CPDF_Reference* pDataSetsRefObj = (CPDF_Reference*)pDataSetsPDFObj;
- CPDF_Object* pDataSetsDircetObj = pDataSetsRefObj->GetDirect();
- if (NULL != pDataSetsDircetObj &&
- pDataSetsDircetObj->GetType() == PDFOBJ_STREAM) {
- pDataSetsStream = (CPDF_Stream*)pDataSetsDircetObj;
+ CPDF_Object* pDataSetsDirectObj = pDataSetsRefObj->GetDirect();
+ if (pDataSetsDirectObj && pDataSetsDirectObj->IsStream()) {
+ pDataSetsStream = (CPDF_Stream*)pDataSetsDirectObj;
}
- } else if (pDataSetsPDFObj->GetType() == PDFOBJ_STREAM) {
+ } else if (pDataSetsPDFObj->IsStream()) {
pDataSetsStream = (CPDF_Stream*)pDataSetsPDFObj;
}
}
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
index e72c1b3f16..dbd3bd0bad 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
@@ -648,7 +648,7 @@ void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc,
CPDF_Object* pXFA = pAcroForm->GetElement("XFA");
if (pXFA == NULL)
return;
- if (pXFA->GetType() != PDFOBJ_ARRAY)
+ if (!pXFA->IsArray())
return;
CPDF_Array* pArray = pXFA->GetArray();
if (NULL == pArray)
@@ -657,12 +657,12 @@ void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc,
for (int i = 1; i < size; i += 2) {
CPDF_Object* pPDFObj = pArray->GetElement(i);
CPDF_Object* pPrePDFObj = pArray->GetElement(i - 1);
- if (pPrePDFObj->GetType() != PDFOBJ_STRING)
+ if (!pPrePDFObj->IsString())
continue;
- if (pPDFObj->GetType() != PDFOBJ_REFERENCE)
+ if (!pPDFObj->IsReference())
continue;
CPDF_Object* pDirectObj = pPDFObj->GetDirect();
- if (pDirectObj->GetType() != PDFOBJ_STREAM)
+ if (!pDirectObj->IsStream())
continue;
if (pPrePDFObj->GetString() == "form") {
CFX_WideStringC form(L"form");
@@ -965,7 +965,7 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
fileStream.Flush();
return FALSE;
}
- if (pXFA->GetType() != PDFOBJ_ARRAY) {
+ if (!pXFA->IsArray()) {
fileStream.Flush();
return FALSE;
}
@@ -978,12 +978,12 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
for (int i = 1; i < size; i += 2) {
CPDF_Object* pPDFObj = pArray->GetElement(i);
CPDF_Object* pPrePDFObj = pArray->GetElement(i - 1);
- if (pPrePDFObj->GetType() != PDFOBJ_STRING)
+ if (!pPrePDFObj->IsString())
continue;
- if (pPDFObj->GetType() != PDFOBJ_REFERENCE)
+ if (!pPDFObj->IsReference())
continue;
CPDF_Object* pDirectObj = pPDFObj->GetDirect();
- if (pDirectObj->GetType() != PDFOBJ_STREAM)
+ if (!pDirectObj->IsStream())
continue;
if (pPrePDFObj->GetString() == "config" && !(flag & FXFA_CONFIG))
continue;
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);
}