summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfppo.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-11 14:00:52 -0700
committerLei Zhang <thestig@chromium.org>2015-06-11 14:00:52 -0700
commitcf2e4c3ecc2a66f0a01e6a1d8c20dcb73e4b8024 (patch)
treedbe0f7d7435d7abb7a939b8ce0e0745e198ee8b1 /fpdfsdk/src/fpdfppo.cpp
parent864773a57a54763b97bef7d38f65375b15c14437 (diff)
downloadpdfium-cf2e4c3ecc2a66f0a01e6a1d8c20dcb73e4b8024.tar.xz
Remove trailing whitespaces in fpdfsdk.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1173343004.
Diffstat (limited to 'fpdfsdk/src/fpdfppo.cpp')
-rw-r--r--fpdfsdk/src/fpdfppo.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index a515e3e339..21ae05d89f 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -1,7 +1,7 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../public/fpdf_ppo.h"
@@ -12,14 +12,14 @@ class CPDF_PageOrganizer
public:
CPDF_PageOrganizer();
~CPDF_PageOrganizer();
-
+
public:
FX_BOOL PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document *pSrcPDFDoc);
FX_BOOL ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* nPageNum, CPDF_Document *pDestPDFDoc, int nIndex);
CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary *pDict, CFX_ByteString nSrctag);
FX_BOOL UpdateReference(CPDF_Object *pObj, CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPtrToPtr);
int GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPtrToPtr, CPDF_Reference *pRef);
-
+
};
@@ -37,17 +37,17 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document
{
if(!pDestPDFDoc || !pSrcPDFDoc)
return false;
-
+
CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot();
if(!pNewRoot) return FALSE;
-
+
//Set the document information////////////////////////////////////////////
-
+
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
-
+
if(!DInfoDict)
return FALSE;
-
+
CFX_ByteString producerstr;
producerstr.Format("PDFium");
DInfoDict->SetAt("Producer", new CPDF_String(producerstr));
@@ -58,7 +58,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document
{
pNewRoot->SetAt("Type", new CPDF_Name("Catalog"));
}
-
+
CPDF_Dictionary* pNewPages = (CPDF_Dictionary*)(pNewRoot->GetElement("Pages")? pNewRoot->GetElement("Pages")->GetDirect() : NULL);
if(!pNewPages)
{
@@ -66,7 +66,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document
FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages);
pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON));
}
-
+
CFX_ByteString cbPageType = pNewPages->GetString("Type","");
if(cbPageType.Equal(""))
{
@@ -79,15 +79,15 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document
CPDF_Array* pNewKids = new CPDF_Array;
FX_DWORD Kidsobjnum = -1;
Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids);//, Kidsobjnum, Kidsgennum);
-
+
pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum));//, Kidsgennum));
- pNewPages->SetAt("Count", new CPDF_Number(0));
+ pNewPages->SetAt("Count", new CPDF_Number(0));
}
return true;
}
-FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* nPageNum,
+FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* nPageNum,
CPDF_Document *pDestPDFDoc,int nIndex)
{
int curpage =nIndex;
@@ -97,7 +97,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray*
for(int i=0; i<nPageNum->GetSize(); i++)
{
-
+
CPDF_Dictionary* pCurPageDict = pDestPDFDoc->CreateNewPage(curpage);
CPDF_Dictionary* pSrcPageDict = pSrcPDFDoc->GetPage(nPageNum->GetAt(i)-1);
if(!pSrcPageDict || !pCurPageDict)
@@ -105,7 +105,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray*
delete pMapPtrToPtr;
return FALSE;
}
-
+
// Clone the page dictionary///////////
FX_POSITION SrcPos = pSrcPageDict->GetStartPos();
while (SrcPos)
@@ -119,15 +119,15 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray*
pCurPageDict->SetAt(cbSrcKeyStr, pObj->Clone());
}
}
-
+
//inheritable item///////////////////////
CPDF_Object* pInheritable = NULL;
//1 MediaBox //required
if(!pCurPageDict->KeyExist("MediaBox"))
{
-
+
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "MediaBox");
- if(!pInheritable)
+ if(!pInheritable)
{
//Search the "CropBox" from source page dictionary, if not exists,we take the letter size.
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox");
@@ -151,7 +151,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray*
if(!pCurPageDict->KeyExist("Resources"))
{
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Resources");
- if(!pInheritable)
+ if(!pInheritable)
{
delete pMapPtrToPtr;
return FALSE;
@@ -162,14 +162,14 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray*
if(!pCurPageDict->KeyExist("CropBox"))
{
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "CropBox");
- if(pInheritable)
+ if(pInheritable)
pCurPageDict->SetAt("CropBox", pInheritable->Clone());
}
//4 Rotate //Optional
if(!pCurPageDict->KeyExist("Rotate"))
{
pInheritable = PageDictGetInheritableTag(pSrcPageDict, "Rotate");
- if(pInheritable)
+ if(pInheritable)
pCurPageDict->SetAt("Rotate", pInheritable->Clone());
}
@@ -177,7 +177,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray*
//Update the reference
FX_DWORD dwOldPageObj = pSrcPageDict->GetObjNum();
FX_DWORD dwNewPageObj = pCurPageDict->GetObjNum();
-
+
pMapPtrToPtr->SetAt((void*)(uintptr_t)dwOldPageObj, (void*)(uintptr_t)dwNewPageObj);
UpdateReference(pCurPageDict, pDestPDFDoc, pMapPtrToPtr);
@@ -190,7 +190,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray*
CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDict, CFX_ByteString nSrctag)
{
- if(!pDict || !pDict->KeyExist("Type") || nSrctag.IsEmpty())
+ if(!pDict || !pDict->KeyExist("Type") || nSrctag.IsEmpty())
return NULL;
CPDF_Object* pType = pDict->GetElement("Type")->GetDirect();
@@ -201,14 +201,14 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDic
if(!pDict->KeyExist("Parent")) return NULL;
CPDF_Object* pParent = pDict->GetElement("Parent")->GetDirect();
if(!pParent || pParent->GetType() != PDFOBJ_DICTIONARY) return NULL;
-
+
CPDF_Dictionary* pp = (CPDF_Dictionary*)pParent;
-
- if(pDict->KeyExist((const char*)nSrctag))
+
+ if(pDict->KeyExist((const char*)nSrctag))
return pDict->GetElement((const char*)nSrctag);
while (pp)
{
- if(pp->KeyExist((const char*)nSrctag))
+ if(pp->KeyExist((const char*)nSrctag))
return pp->GetElement((const char*)nSrctag);
else if (pp->KeyExist("Parent"))
{
@@ -217,11 +217,11 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDic
}
else break;
}
-
+
return NULL;
}
-FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pDoc,
+FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pDoc,
CFX_MapPtrToPtr* pMapPtrToPtr)
{
switch (pObj->GetType())
@@ -237,7 +237,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object *pObj, CPDF_Document *pD
case PDFOBJ_DICTIONARY:
{
CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj;
-
+
FX_POSITION pos = pDict->GetStartPos();
while(pos)
{
@@ -298,9 +298,9 @@ int CPDF_PageOrganizer::GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPt
if(!pRef)
return 0;
dwObjnum = pRef->GetRefObjNum();
-
+
size_t dwNewObjNum = 0;
-
+
pMapPtrToPtr->Lookup((void*)dwObjnum, (void*&)dwNewObjNum);
if(dwNewObjNum)
{
@@ -319,7 +319,7 @@ int CPDF_PageOrganizer::GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPt
{
return 0;
}
-
+
if(pClone->GetType() == PDFOBJ_DICTIONARY)
{
CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone;
@@ -340,7 +340,7 @@ int CPDF_PageOrganizer::GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPt
}
dwNewObjNum = pDoc->AddIndirectObject(pClone);//, onum, gnum);
pMapPtrToPtr->SetAt((void*)dwObjnum, (void*)dwNewObjNum);
-
+
if(!UpdateReference(pClone, pDoc, pMapPtrToPtr))
{
pClone->Release();
@@ -375,7 +375,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, CFX_WordArray* pageAr
nStringTo = nLength;
}
cbMidRange = rangstring.Mid(nStringFrom,nStringTo-nStringFrom);
-
+
int nMid = cbMidRange.Find('-');
if(nMid == -1)
{
@@ -397,10 +397,10 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, CFX_WordArray* pageAr
int nEnd = cbMidRange.GetLength()-nMid;
if(nEnd ==0)return FALSE;
-
+
// int nEndPageNum = (nEnd == 0)?nCount:atol(cbMidRange.Mid(nMid,nEnd));
int nEndPageNum = atol(cbMidRange.Mid(nMid,nEnd));
-
+
if(nStartPageNum < 0 ||nStartPageNum >nEndPageNum|| nEndPageNum > nCount)
{
return FALSE;
@@ -417,7 +417,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, CFX_WordArray* pageAr
return TRUE;
}
-DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc,
+DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc,
FPDF_BYTESTRING pagerange, int index)
{
if(dest_doc == NULL || src_doc == NULL )
@@ -437,7 +437,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMEN
pageArray.Add(i);
}
}
-
+
CPDF_Document* pDestDoc = (CPDF_Document*)dest_doc;
CPDF_PageOrganizer pageOrg;