ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cdpofprintingdevice.h
branchRCL_3
changeset 20 159fc2f68139
parent 17 26673e532f65
child 21 d59c248c9d36
equal deleted inserted replaced
17:26673e532f65 20:159fc2f68139
     1 /*
       
     2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Contains the CDPOFPrintingDevice class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDPOFPRINTINGDEVICE_H
       
    20 #define CDPOFPRINTINGDEVICE_H
       
    21 
       
    22 #include <fbs.h>
       
    23 #include <AknGlobalConfirmationQuery.h>
       
    24 #include <data_caging_path_literals.hrh>
       
    25 
       
    26 #include "mprotprintingdevice.h"
       
    27 #include "crsdpofengine.h"
       
    28 #include "tmapping.h"
       
    29 #include "cconfirmationquery.h"
       
    30 #include "mconfirmationnotify.h"
       
    31 
       
    32 //  FORWARD DECLARATIONS
       
    33 class CPrinterCapabilities;
       
    34 class CPrinterElement;
       
    35 class CCapabilityArray;
       
    36 class CPrintJob;
       
    37 class TSetting;
       
    38 
       
    39 
       
    40 /**
       
    41  *	@brief CDPOFPrintingDevice implements MProtPrintingDevice. This makes the class the "published" class of the DLL it is in.
       
    42  */
       
    43 class CDPOFPrintingDevice : public CActive, public MProtPrintingDevice, public MDpofEngineObserver, public MConfirmationNotify
       
    44 	{
       
    45 		public:
       
    46 			static MProtPrintingDevice* NewL();
       
    47 		
       
    48 			// Default constructor and destructor.
       
    49 			CDPOFPrintingDevice();
       
    50 			~CDPOFPrintingDevice();
       
    51 
       
    52 		public: // From MProtPrintingDevice
       
    53 			
       
    54 			// General.
       
    55 			void ConstructL(const TDesC& aDLLPath);
       
    56 			TVersion Version();
       
    57 			TUint SupportedProtocols();
       
    58 			// Discovery.
       
    59 			void StartDiscoveryL(MProtDiscoveryObserver& aObserver, TUint aProtocols = 0);
       
    60 			TInt RemoveCachedDeviceL(TInt aDeviceID);
       
    61 			void CancelDiscovery(TBool aDoCallBack = ETrue);
       
    62 			// Print.
       
    63 			TInt CreatePrintJobL(TInt aDeviceID, RPointerArray<TDesC>& aImages, MProtPrintEventObserver& aObserver);
       
    64 			void SubmitPrintJobL();
       
    65 			TInt CancelPrintJob();
       
    66 			TInt ContinuePrintJobL();
       
    67 			TInt GetNumPrintPages();
       
    68 			TInt GetPrintJobStatus();
       
    69 			TInt GetPrinterStatus(TInt aDeviceID);
       
    70 			// Capabilities.
       
    71 			TInt GetDeviceCapabilityIDsL(TInt aDeviceID, RArray<TInt>& aCapabilityIDs);
       
    72 			TInt GetDeviceCapabilityL(TInt aDeviceID, TInt aCapabilityID, TPrintCapability& aCapability);
       
    73 			TInt GetJobSetting(TInt aCapabilityID, TInt& aValue);
       
    74 			TInt SetJobSettingL(TInt aCapabilityID, TInt aValue, TInt& aAffectedCapability);
       
    75 			// Preview.
       
    76 			TInt GetNumPreviewPages();
       
    77 			TInt GetJobTemplateIconL(TInt aTemplateID, TInt& aFsBitmapHandle);
       
    78 			TInt CreatePreviewImage(TInt aPageNumber);
       
    79 
       
    80 			void RegisterIdleObserver(MProtIdleObserver * /*aObserver*/) {};
       
    81 			
       
    82 			public: // MBTOnNotify
       
    83 			void BTOnCompleteL( TBool aResult ); 
       
    84 			void ConfirmationQueryCompleteL ( TInt aError );
       
    85 			
       
    86 			void OverwriteExistingJobL ();
       
    87 			
       
    88 		
       
    89 			void SetNumsOfCopiesL( const RArray<TInt>& aNumsOfCopies, TInt& aErr );	
       
    90 
       
    91 		public: // From MDpofEngineObserver
       
    92 
       
    93 			void HandleDpofEngineEventL(const TInt aStatus, const TInt aRetCode);
       
    94 		
       
    95 		protected:	// From CActive
       
    96 			
       
    97 			void DoCancel();	
       
    98 			void RunL();
       
    99 
       
   100 		private:
       
   101 			// Utils.
       
   102 			// Capabilities Section.
       
   103 			CCapabilityArray* LoadCapabilityL(RResourceFile& aResFile, TInt aCapID);
       
   104 			CPrinterElement* FindDeviceL(TInt aPrinterID);
       
   105 			TBool FindSetting(TInt aCapabilityID, TSetting& aSetting);
       
   106 			TInt AddReadyRequestAndSetActive( TInt aRequest );
       
   107 			TInt CheckReadyRequestAndSetActive();
       
   108 			// Set MMC printer
       
   109 			void SetMMCPrinterL();
       
   110 
       
   111 		    // Confirmation to override existing autoprint file
       
   112 	        void ShowConfirmationQueryL();
       
   113 		
       
   114 		private: // data
       
   115 				
       
   116 			/// Protocol Capabilities.
       
   117 			CCapabilityArray* iCapabilities;
       
   118 			/// Array to save all the devices discovered.
       
   119 			RPointerArray<CPrinterElement> iDeviceList;
       
   120 			/// Print job object.
       
   121 			CPrintJob* iPrintJob;
       
   122 
       
   123 			/// DPOF Engine.
       
   124 			CRsDpofEngine *iDPOF;
       
   125 
       
   126 			/// Array to save all the icon / template pairs supported by a protocol.
       
   127 			RArray<TMapping> iMappingArray;			
       
   128 		
       
   129 			/// Print error.
       
   130 			TInt iPrintError;
       
   131 			/// Print error message code.
       
   132 			TInt iPrintErrorMsgCode;
       
   133 			
       
   134 			RArray<TInt> iReadyRequests;			
       
   135 	
       
   136 	        TBool iCancelledByUser;
       
   137 	   
       
   138 	        CConfirmationQuery* iConfirmationQuery;
       
   139 	
       
   140 	        CAknGlobalConfirmationQuery* iPQ;
       
   141 	        
       
   142 	        HBufC* iQuestion;
       
   143 	};
       
   144 
       
   145 #endif // CDPOFPRINTINGDEVICE_H
       
   146 
       
   147 //  End of File