Remove trailing whitespaces in fpdfsdk.
[pdfium.git] / fpdfsdk / src / fpdfeditpage.cpp
index 5c43d4d..12c2cce 100644 (file)
@@ -1,12 +1,11 @@
 // 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 "x:/pdf/fpdfapi5/include/fpdfapi.h"
+#include "../../public/fpdf_edit.h"
 #include "../include/fsdk_define.h"
-#include "../include/fpdfedit.h"
 
 
 #if _FX_OS_ == _FX_ANDROID_
@@ -17,9 +16,7 @@
 
 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument()
 {
-       CPDF_Document* pDoc = FX_NEW CPDF_Document;
-       if (!pDoc)
-               return NULL;
+       CPDF_Document* pDoc = new CPDF_Document;
        pDoc->CreateNewDoc();
        time_t currentTime;
 
@@ -37,18 +34,14 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument()
                        }
                }
        }
-       
+
        CPDF_Dictionary* pInfoDict = NULL;
        pInfoDict = pDoc->GetInfo();
        if (pInfoDict)
        {
                if(FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
                        pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr));
-#ifdef FOXIT_CHROME_BUILD
-               pInfoDict->SetAt("Creator",FX_NEW CPDF_String(L"Google"));
-#else
-               pInfoDict->SetAt("Creator",FX_NEW CPDF_String(L"Foxit PDF SDK DLL 2.0 - Foxit Software"));
-#endif
+               pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium"));
        }
 
        return pDoc;
@@ -57,9 +50,9 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument()
 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index)
 {
        CPDF_Document* pDoc = (CPDF_Document*)document;
-       if (pDoc == NULL) 
+       if (pDoc == NULL)
                return;
-       if (page_index < 0 || page_index >= pDoc->GetPageCount()) 
+       if (page_index < 0 || page_index >= pDoc->GetPageCount())
                return;
 
        pDoc->DeletePage(page_index);
@@ -76,23 +69,23 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index,
                page_index = 0;
        if(pDoc->GetPageCount()<page_index)
                page_index = pDoc->GetPageCount();
-//     if (page_index < 0 || page_index >= pDoc->GetPageCount()) 
+//     if (page_index < 0 || page_index >= pDoc->GetPageCount())
 //             return NULL;
 
        CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
        if(!pPageDict)
                return NULL;
-       CPDF_Array* pMediaBoxArray = FX_NEW CPDF_Array;
-       pMediaBoxArray->Add(FX_NEW CPDF_Number(0));
-       pMediaBoxArray->Add(FX_NEW CPDF_Number(0));
-       pMediaBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(width)));
-       pMediaBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(height)));
+       CPDF_Array* pMediaBoxArray = new CPDF_Array;
+       pMediaBoxArray->Add(new CPDF_Number(0));
+       pMediaBoxArray->Add(new CPDF_Number(0));
+       pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width)));
+       pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height)));
 
        pPageDict->SetAt("MediaBox", pMediaBoxArray);
-       pPageDict->SetAt("Rotate", FX_NEW CPDF_Number(0));
-       pPageDict->SetAt("Resources", FX_NEW CPDF_Dictionary);
+       pPageDict->SetAt("Rotate", new CPDF_Number(0));
+       pPageDict->SetAt("Resources", new CPDF_Dictionary);
 
-       CPDF_Page* pPage = FX_NEW CPDF_Page;
+       CPDF_Page* pPage = new CPDF_Page;
        pPage->Load(pDoc,pPageDict);
        pPage->ParseContent();
 
@@ -137,7 +130,7 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page)
        {
                return -1;
        }
-       
+
        return rotate;
 }
 
@@ -275,12 +268,11 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page)
 }
 
 DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
-                        double a, double b, double c, double d, double e, double f)  
+                        double a, double b, double c, double d, double e, double f)
 {
        CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object;
        if(pPageObj == NULL)
                return;
-//PDF_ImageObject* pImageObj = FX_NEW CPDF_ImageObject;
        CFX_AffineMatrix matrix((FX_FLOAT)a,(FX_FLOAT)b,(FX_FLOAT)c,(FX_FLOAT)d,(FX_FLOAT)e,(FX_FLOAT)f);
        pPageObj->Transform(matrix);
 }
@@ -300,17 +292,16 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
                CFX_AffineMatrix matrix((FX_FLOAT)a,(FX_FLOAT)b,(FX_FLOAT)c,(FX_FLOAT)d,(FX_FLOAT)e,(FX_FLOAT)f);
                rect.Transform(&matrix);
                CPDF_Array *pRectArray = NULL;
-               pRectArray = pAnnot->m_pAnnotDict->GetArray("Rect");
+               pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
                if (!pRectArray) pRectArray=CPDF_Array::Create();
-               pRectArray->SetAt(0,FX_NEW CPDF_Number(rect.left));
-               pRectArray->SetAt(1,FX_NEW CPDF_Number(rect.bottom));
-               pRectArray->SetAt(2,FX_NEW CPDF_Number(rect.right));
-               pRectArray->SetAt(3,FX_NEW CPDF_Number(rect.top));
-               pAnnot->m_pAnnotDict->SetAt("Rect",pRectArray);
+               pRectArray->SetAt(0, new CPDF_Number(rect.left));
+               pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
+               pRectArray->SetAt(2, new CPDF_Number(rect.right));
+               pRectArray->SetAt(3, new CPDF_Number(rect.top));
+               pAnnot->GetAnnotDict()->SetAt("Rect",pRectArray);
 
                //Transform AP's rectangle
                //To Do
-
        }
 
 }
@@ -326,5 +317,5 @@ DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate)
        CPDF_Dictionary* pDict = pPage->m_pFormDict;
        rotate %=4;
 
-       pDict->SetAt("Rotate", FX_NEW CPDF_Number(rotate * 90));
+       pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
 }