ImagePrint/ImagePrintEngine/ImagePrintServer/inc/cserverjobguard.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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSERVERJOBGUARD_H
       
    20 #define CSERVERJOBGUARD_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "imageprint.h"
       
    25 #include "tjobguarddata.h"
       
    26 
       
    27 class CImagePrintBody;
       
    28 class TMessageWrp2;
       
    29 
       
    30 class CServerJobGuard : public CBase, public MPrintEventObserver
       
    31 	{
       
    32 	public:
       
    33 
       
    34 		/**
       
    35 		 *	2-phase constructor
       
    36 		 *
       
    37 		 *	@param aEngine printing engine
       
    38 		 *	@return new object
       
    39 		 */
       
    40 		static CServerJobGuard* NewL( CImagePrintBody& aEngine );
       
    41 		
       
    42 		/**
       
    43 		 *	Destructor		 
       
    44 		 */
       
    45 		~CServerJobGuard();
       
    46 
       
    47 	private: // from MPrintEventObserver
       
    48 		
       
    49 		void PrintJobProgressEvent(TInt aStatus, TInt aPercentCompletion, TInt aJobStateCode);
       
    50 		void PrintJobErrorEvent(TInt aError, TInt aErrorStringCode);
       
    51 		void PrinterStatusEvent(TInt aError, TInt aErrorStringCode);
       
    52 		void PreviewImageEvent(TInt aFsBitmapHandle);
       
    53 		void ShowMessageL(TInt aMsgLine1Code, TInt aMsgLine2Code);
       
    54 		TBool AskYesNoQuestionL(TInt aMsgLine1Code, TInt aMsgLine2Code);
       
    55 		const TDesC& AskForInputL(TInt aMsgLine1Code, TInt aMsgLine2Code);
       
    56 		
       
    57 	public:
       
    58 	
       
    59 		/**
       
    60 		 *	Prepare print job by copying image file name into internal buffer
       
    61 		 *
       
    62 		 *	@param aMessage message contains file name of one image. 
       
    63 		 */
       
    64 		void PrepareL( TMessageWrp2& aMessage );
       
    65 		
       
    66 		/**
       
    67 		 *	Create print job and set this object as print job events observer
       
    68 		 *
       
    69 		 *	@param aMessage message contains printer id
       
    70 		 */
       
    71 		TInt CreateL( TMessageWrp2& aMessage );
       
    72 		
       
    73 		/**
       
    74 		 *	Continue waiting for print job events
       
    75 		 *
       
    76 		 *	@param aMessage message completed upon event arrival
       
    77 		 */
       
    78 		void ContinueCreateL( TMessageWrp2& aMessage );
       
    79 		
       
    80 		/**
       
    81 		 *	Stop waiting for print job events. Cancel waiting message
       
    82 		 */
       
    83 		void Stop();
       
    84 
       
    85 	private:
       
    86 
       
    87 		CServerJobGuard( CImagePrintBody& aEngine );
       
    88 		void ConstructL();
       
    89 		void Process( TInt aErr = KErrNone );
       
    90 		void DoProcessL();
       
    91 		void DoPreProcessL( const TJobGuardData& aData );
       
    92 		
       
    93 	private: // data
       
    94 	
       
    95 		CImagePrintBody& iEngine;
       
    96 		TMessageWrp2* iMessage;
       
    97 		RArray<TJobGuardData> iBuffer;
       
    98 		RPointerArray<TDesC> iImages;
       
    99 		TBool iRequestActive;
       
   100 	};
       
   101 
       
   102 
       
   103 #endif // CSERVERJOBGUARD_H
       
   104 
       
   105 //  End of File