/*
//
//   ADOBE SYSTEMS INCORPORATED
//   Copyright (C) 2000-2003 Adobe Systems Incorporated
//   All rights reserved.
//
//   NOTICE: Adobe permits you to use, modify, and distribute this file
//   in accordance with the terms of the Adobe license agreement
//   accompanying it. If you have received this file from a source other
//   than Adobe, then your use, modification, or distribution of it
//   requires the prior written permission of Adobe.
//
*/

/*
//
// Decryption.h
//
*/

#ifndef _Decryption_h_
#define _Decryption_h_

#include "CosCalls.h"
#include "PEWCalls.h"
#include "PagePDECntCalls.h"
#include "ASCalls.h"
#include "PEExpT.h"
#include "ASExpT.h"
#include "PDCalls.h"

class  Decryption
{
public :
                // default constructor: initializing PDFL
                Decryption();

                // constructor: init PDFL and attemp to authorize the input
                // document with open permission
                Decryption( const   char  *inputDoc);

                // destructor: terminate PDFL and clean up
                ~Decryption();

                // member function to authorize permissions to operate on the document
               ACCB1  ASBool   ACCB2   ClientAuthMasterProc();

                // member function to operate on the decrypted document
                // operation performed:
                // extracting pages from the decrypted document and save
                // them in reverse order to a new document with no security
                // settings.
                void   ProcessDocument( const   char  *outputDoc);

private :
                // PDAuthProcEx callback called by PDDocOpenEx to authorize open permission
                static  ACCB1  ASBool   ACCB2   ClientAuthUserProc(PDDoc  pdDoc,  void  *clientData);

                // helper function called by ProcessDocument to set extracted page contents
                // to pages of the output document
                void   SetPageContent(PDPage  pdPage,  PDEContent  pdeContent);

                // the PDDoc object of the original encrypted document
                PDDoc   orgDoc;
};

#endif // _Decryption_h_