Merge to XFA: Create top-level public/ header directory.
[pdfium.git] / fpdfsdk / src / fpdfppo.cpp
index a5c4275..21cf647 100644 (file)
@@ -4,8 +4,9 @@
  
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#include "../include/fpdfppo.h"
+#include "../../public/fpdf_ppo.h"
 #include "../include/fsdk_define.h"
+#include "../include/fpdfxfa/fpdfxfa_doc.h"
 
 class CPDF_PageOrganizer
 {
@@ -49,12 +50,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document *pDestPDFDoc, CPDF_Document
                return FALSE;
        
        CFX_ByteString producerstr;
-       
-#ifdef FOXIT_CHROME_BUILD
-       producerstr.Format("Google");
-#else
-        producerstr.Format("Foxit PDF SDK %s - Foxit Corporation", "2.0");
-#endif
+       producerstr.Format("PDFium");
        DInfoDict->SetAt("Producer", new CPDF_String(producerstr));
 
        //Set type////////////////////////////////////////////////////////////////
@@ -428,8 +424,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMEN
        if(dest_doc == NULL || src_doc == NULL )
                return FALSE;
        CFX_WordArray pageArray;
-       CPDF_Document* pSrcDoc = (CPDF_Document*)src_doc;
-       int nCount = pSrcDoc->GetPageCount();
+       CPDFXFA_Document* pSrcDoc = (CPDFXFA_Document*)src_doc;
+       CPDF_Document* pSrcPDFDoc = pSrcDoc->GetPDFDoc();
+       int nCount = pSrcPDFDoc->GetPageCount();
        if(pagerange)
        {
                if(ParserPageRangeString(pagerange,&pageArray,nCount) == FALSE)
@@ -443,12 +440,13 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMEN
                }
        }
        
-       CPDF_Document* pDestDoc = (CPDF_Document*)dest_doc;
+       CPDFXFA_Document* pDestDoc = (CPDFXFA_Document*)dest_doc;
+       CPDF_Document* pDestPDFDoc = pDestDoc->GetPDFDoc();
        CPDF_PageOrganizer pageOrg;
 
-       pageOrg.PDFDocInit(pDestDoc,pSrcDoc);
+       pageOrg.PDFDocInit(pDestPDFDoc,pSrcPDFDoc);
 
-       if(pageOrg.ExportPage(pSrcDoc,&pageArray,pDestDoc,index))
+       if(pageOrg.ExportPage(pSrcPDFDoc,&pageArray,pDestPDFDoc,index))
                return TRUE;
        return FALSE;
 }
@@ -457,13 +455,15 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, F
 {
        if(src_doc == NULL || dest_doc == NULL)
                return false;
-       CPDF_Document* pSrcDoc = (CPDF_Document*)src_doc;
-       CPDF_Dictionary* pSrcDict = pSrcDoc->GetRoot();
-       pSrcDict = pSrcDict->GetDict(FX_BSTRC("ViewerPreferences"));;
+       CPDFXFA_Document* pSrcDoc = (CPDFXFA_Document*)src_doc;
+       CPDF_Document* pSrcPDFDoc = pSrcDoc->GetPDFDoc();
+       CPDF_Dictionary* pSrcDict = pSrcPDFDoc->GetRoot();
+       pSrcDict = pSrcDict->GetDict(FX_BSTRC("ViewerPreferences"));
        if(!pSrcDict)
                return FALSE;
-       CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc;
-       CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
+       CPDFXFA_Document* pDstDoc = (CPDFXFA_Document*)dest_doc;
+       CPDF_Document* pDstPDFDoc = pDstDoc->GetPDFDoc();
+       CPDF_Dictionary* pDstDict = pDstPDFDoc->GetRoot();
        if(!pDstDict)
                return FALSE;
        pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE));