ImagePrint/ImagePrintEngine/DeviceProtocols/dpof/inc/cprintercapabilities.h
branchGCC_SURGE
changeset 25 59ea2209bb67
parent 23 08cc4cc059d4
parent 15 a92d00fca574
equal deleted inserted replaced
23:08cc4cc059d4 25:59ea2209bb67
     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 CPrinterCapabilities class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPRINTERCAPABILITIES_H
       
    20 #define CPRINTERCAPABILITIES_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <barsread.h>
       
    24 
       
    25 #include "ccapabilityarray.h"
       
    26 
       
    27 /**
       
    28  *	@brief Class that stores a printer class capabilities in full detail.
       
    29  *
       
    30  *	class PrinterCapabilities - An array which holds pointers to capabilities that 
       
    31  *	exist in the CapabilitiesArray(s).  Each printer that is found will have it's own
       
    32  *	PrinterCapabilities object, and when the PrinterCapability functions are called from
       
    33  *	the ClientAPI, the data is obtained directly from this PrinterCapabilities class.
       
    34  *	Different printers may refer back to the same object from the capabilities Array.  
       
    35  *	When the PrinterCapabilities object is created, it will contain the default 
       
    36  *	capabilities and current settings.  If the printer is selected for the print job,
       
    37  *	the settings and configuration may change to reflect the current print job settings.
       
    38  *	
       
    39  *	BUILDING PRINTER CAPABILITIES
       
    40  *	Each resource contains a printerclass field, which identifies which class of printer this 
       
    41  *	capability is defined for.  When a printer is discovered and a new PrinterCapabilities 
       
    42  *	object is created,  the CapabilitiyArray is searched for capabilites with that class to 
       
    43  *	add.  This occurs in the BuildCCapabilityArray function. 
       
    44  *
       
    45  *	While a resource file can have the same capabilitiy defined multiple times for multiple 
       
    46  *	PrinterClasses, A PrinterClass can have a capability defined only once for the class.
       
    47  *	One of the classes is "ELinked".  Capabilities of this class are dependent upon the current
       
    48  *	value of other capabilities and can be linked into one or more other PrinterCapability arrays.
       
    49  *	Each enumerated value in the resource is a value pair, with the second number being a link code.
       
    50  *	If non-zero, then the resource with right LinkID is also added to the PrinterCapabilites.
       
    51  *	When SetCurrentCapability is called and a current value is changed, the linked capability must
       
    52  *	also be checked to see if it is changed.  
       
    53  *
       
    54  *	Note that setting the current value can only occur for the current print job, but when it does
       
    55  *	the capabilities for a particular printer can actually change during the life of the job,
       
    56  *	requiring the application to get the printer capabilities multiple times.  
       
    57  *	Notes on implementation Limitations:  
       
    58  *
       
    59  *	The current implementation uses one and only one CapabilitiesInfo object for
       
    60  *	each capabiltiy described in the resource file.  All references to the capability
       
    61  *	refer back to this object.  This is fine as long as there is only one print job.
       
    62  *	When we have multiple print jobs, this will not work for two reasons.  
       
    63  *
       
    64  *	1 - There could be multiple current settings fora particular capability. 
       
    65  *
       
    66  *	2 - Different jobs could configure linked capabilities for a printer. 
       
    67  */
       
    68 class CPrinterCapabilities : public CBase
       
    69 	{
       
    70 	public:
       
    71 		static CPrinterCapabilities* NewL(CCapabilityArray* aSourceArray, TInt aPrinterClass);
       
    72 		~CPrinterCapabilities();
       
    73 		TInt Count() const;			
       
    74 		void GetIDs(RArray<TInt>& aCapabilityIDs) const;
       
    75 		TInt GetCapability(TInt aCapabilityID, TPrintCapability& aCapability) const;
       
    76 		TInt SetCurrentValueL(TInt aCapabilityID, TInt aValue);
       
    77 		TBool GetCurrentValue(TInt aCapabilityID, TInt &aCapabilityValue) const;
       
    78 
       
    79 	private:
       
    80 		CPrinterCapabilities(CCapabilityArray* aSourceArray, TInt aPrinterClass);
       
    81 		void ConstructL();
       
    82 		void BuildCapabilityArrayL();
       
    83 
       
    84 	private:
       
    85 		TInt iPrinterClass;
       
    86 		RPointerArray<CCapabilityInfo> iPrinterDataArray;
       
    87 		CCapabilityArray* iSourceArray;
       
    88 	};
       
    89 
       
    90 #endif // CPRINTERCAPABILITIES_H
       
    91 
       
    92 //  End of File