DirectPrint/DirectPrintServer/inc/directprintserverjobguard.h
author Steven Cao <steven.1.cao@nokia.com>
Tue, 11 May 2010 14:10:02 +0800
changeset 15 2275db202402
parent 12 613a5ff70823
permissions -rw-r--r--
Pickup K3's code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     1
/*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     2
* Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     3
* All rights reserved.
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     4
* This component and the accompanying materials are made available
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     6
* which accompanies this distribution, and is available
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     8
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
     9
* Initial Contributors:
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    10
* Kanrikogaku Kenkyusho, Ltd. - Initial contribution
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    11
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    12
* Contributors:
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    13
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    14
* Description:  
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    15
*
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    16
*/
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    17
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    18
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    19
#ifndef DIRECTPRINTSERVERJOBGUARD_H
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    20
#define DIRECTPRINTSERVERJOBGUARD_H
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    21
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    22
#include <e32base.h>
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    23
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    24
#include "imageprint.h"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    25
#include "directprintjobguarddata.h"
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    26
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    27
class CDirectPrintBody;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    28
class TDpMessage;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    29
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    30
class CDirectPrintServerJobGuard : public CBase, public MPrintEventObserver
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    31
	{
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    32
	public:
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    33
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    34
		/**
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    35
		 *	2-phase constructor
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    36
		 *
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    37
		 *	@param aEngine printing engine
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    38
		 *	@return new object
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    39
		 */
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    40
		static CDirectPrintServerJobGuard* NewL( CDirectPrintBody& aEngine );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    41
		
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    42
		/**
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    43
		 *	Destructor
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    44
		 */
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    45
		~CDirectPrintServerJobGuard();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    46
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    47
	private: // from MPrintEventObserver
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    48
		
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    49
		void PrintJobProgressEvent(TInt aStatus, TInt aPercentCompletion, TInt aJobStateCode);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    50
		void PrintJobErrorEvent(TInt aError, TInt aErrorStringCode);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    51
		void PrinterStatusEvent(TInt aError, TInt aErrorStringCode);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    52
		void PreviewImageEvent(TInt aFsBitmapHandle);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    53
		void ShowMessageL(TInt aMsgLine1Code, TInt aMsgLine2Code);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    54
		TBool AskYesNoQuestionL(TInt aMsgLine1Code, TInt aMsgLine2Code);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    55
		const TDesC& AskForInputL(TInt aMsgLine1Code, TInt aMsgLine2Code);
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    56
		
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    57
	public:
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    58
	
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    59
		/**
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    60
		 *	Prepare print job by copying image file name into internal buffer
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    61
		 *
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    62
		 *	@param aMessage message contains file name of one image. 
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    63
		 */
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    64
		void PrepareL( TDpMessage& aMessage );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    65
		
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    66
		/**
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    67
		 *	Create print job and set this object as print job events observer
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    68
		 *
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    69
		 *	@param aMessage message contains printer id
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    70
		 */
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    71
		TInt CreateL( TDpMessage& aMessage );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    72
		
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    73
		/**
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    74
		 *	Continue waiting for print job events
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    75
		 *
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    76
		 *	@param aMessage message completed upon event arrival
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    77
		 */
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    78
		void ContinueCreateL( TDpMessage& aMessage );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    79
		
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    80
		/**
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    81
		 *	Stop waiting for print job events. Cancel waiting message
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    82
		 */
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    83
		void Stop();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    84
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    85
	private:
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    86
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    87
		CDirectPrintServerJobGuard( CDirectPrintBody& aEngine );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    88
		void ConstructL();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    89
		void Process( TInt aErr = KErrNone );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    90
		void DoProcessL();
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    91
		void DoPreProcessL( const TDirectPrintJobGuardData& aData );
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    92
		
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    93
	private: // data
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    94
	
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    95
		CDirectPrintBody& iEngine;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    96
		TDpMessage* iMessage;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    97
		RArray<TDirectPrintJobGuardData> iBuffer;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    98
		RPointerArray<TDesC> iImages;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
    99
		TBool iRequestActive;
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   100
	};
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   101
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   102
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   103
#endif // DIRECTPRINTSERVERJOBGUARD_H
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   104
2275db202402 Pickup K3's code
Steven Cao <steven.1.cao@nokia.com>
parents: 12
diff changeset
   105
//  End of File