fax/faxclientandserver/faxio/CFAXIO.H
changeset 20 244d7c5f118e
parent 19 1f776524b15c
child 23 6b1d113cdff3
equal deleted inserted replaced
19:1f776524b15c 20:244d7c5f118e
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #if defined(__VC32__) && _MSC_VER==1100
       
    23 // Disable MSVC++ 5.0 aggressive warnings about non-expansion of inline functions. 
       
    24 #pragma warning(disable : 4710)	// function '...' not expanded
       
    25 #endif
       
    26 
       
    27 #if !defined(__CFAXIO_H__)
       
    28 #define __CFAXIO_H__
       
    29 
       
    30 #if !defined(__E32STD_H__)
       
    31 #include <e32std.h>
       
    32 #endif // __E32STD_H__
       
    33 
       
    34 #if !defined(__E32BASE_H__)
       
    35 #include <e32base.h>
       
    36 #endif // __E32BASE_H__
       
    37 
       
    38 #if !defined(__F32FILE_H__)
       
    39 #include <f32file.h>
       
    40 #endif // __F32FILE_H__
       
    41 
       
    42 #if !defined(__FAXDEFN_H__)
       
    43 #include <faxdefn.h>
       
    44 #endif // __FAXDEFN_H__
       
    45 
       
    46 /**
       
    47 @internalComponent
       
    48 */
       
    49 typedef TUint32 TCodeDef;
       
    50 
       
    51 /**
       
    52 @publishedPartner
       
    53 @released
       
    54 */
       
    55 const TInt KFaxFileStoreUidVal(268435712);
       
    56 
       
    57 class CFileWriteStream;
       
    58 class CFileReadStream;
       
    59 
       
    60 
       
    61 /**
       
    62 Fax line coding/decoding.
       
    63 
       
    64 Provides utility functions for encoding and decoding fax scan lines. The lines 
       
    65 can be encoded/decoded as 1 dimensional modified Huffman or 2 dimensional 
       
    66 modified Read.
       
    67 
       
    68 Users must first create a CFaxT4 object using NewL() or NewLC(). Specific 
       
    69 functions are provided to encode/decode scan lines using the two coding schemes. 
       
    70 In addition, general functions are provided which determine the coding type 
       
    71 from the values specified when the object is initialised - using PageInitialise().
       
    72 
       
    73 In pre-v5.1 releases of Symbian OS, this class was defined in faxstore.h and 
       
    74 its import library was faxst2.lib.
       
    75 
       
    76 @publishedPartner
       
    77 @released 
       
    78 */
       
    79 class CFaxT4 : public CBase // replaces FaxT4 class used up to faxstore 013
       
    80 	{
       
    81 public:
       
    82 	IMPORT_C static CFaxT4 * NewL ();
       
    83 	IMPORT_C static CFaxT4 * NewLC ();
       
    84 	IMPORT_C void EncodeScanLine(const TDesC8& aScanLine,TDes8& anEncodedScanLine);
       
    85 	IMPORT_C TInt DecodeScanLine(TDes8& aScanLine,const TDesC8& anEncodedScanLine);
       
    86 	IMPORT_C void EncodeScanLine1D(const TDesC8& aScanLine,TDes8& anEncodedScanLine);
       
    87 	IMPORT_C TInt DecodeScanLine1D(TDes8& aScanLine,const TDesC8& anEncodedScanLine);
       
    88 	IMPORT_C void EncodeScanLine2D(const TDesC8& aScanLine,TDes8& anEncodedScanLine);
       
    89 	IMPORT_C TInt DecodeScanLine2D(TDes8& aScanLine,const TDesC8& anEncodedScanLine);
       
    90 	IMPORT_C void PageInitialize (TFaxResolution aResolution, TFaxCompression aCompression, TInt aFlag2 = 0);
       
    91 
       
    92 private:
       
    93 	inline CFaxT4();
       
    94 
       
    95 	void DoEncodeScanLine2D (const TDesC8 & aScanLine, TDes8 & anEncodedScanLine);
       
    96 	void DecodeHuffman(const TDesC8 & aEncodedScanLine);
       
    97 
       
    98 private:
       
    99 	TFaxResolution iResolution;
       
   100 	TFaxCompression iCompression;
       
   101 	TInt iLineCount;
       
   102 	TInt iK;
       
   103 	TInt iReservedFlag2;
       
   104 	const TUint8* iEndRef;
       
   105 	TUint8 iRef[KFaxPixelsPerScanLine+4];
       
   106 	};
       
   107 
       
   108 /**
       
   109 Fax header line information.
       
   110 
       
   111 Contains the information needed to generate a fax header line from a font 
       
   112 bitmap line and a header line template. For a detailed discussion of how this 
       
   113 class interacts with others to generate the fax header line.
       
   114 
       
   115 In pre-v5.1 releases of Symbian OS, this class was defined in faxstore.h.
       
   116 
       
   117 The iOffset members specify an offset in a TRawScanLine. In other words, the 
       
   118 offsets are specified in bytes rather than in characters or bits. 
       
   119 
       
   120 @publishedPartner
       
   121 @released
       
   122 */
       
   123 class TFaxHeaderInfo
       
   124 	{
       
   125 public:
       
   126 	/** Width of the font in bytes. */
       
   127 	TInt iHeaderFontWidthInBytes;	
       
   128 	/** Height of the font in lines. */
       
   129 	TInt iHeaderFontHeightInLines;
       
   130 	/** Offset to two digit day of month. */
       
   131 	TInt iOffsetToDay;           
       
   132 	/** Offset to two digits month of year. */
       
   133 	TInt iOffsetToMonth;         
       
   134 	/** Offset to four digits year. */
       
   135 	TInt iOffsetToYear;         
       
   136 	/** Offset to two digits hour (24 hour clock). */
       
   137 	TInt iOffsetToHour;       
       
   138 	/** Offset to two digits minute. */
       
   139 	TInt iOffsetToMinute;        
       
   140 	/** Offset to two digits for total pages. */
       
   141 	TInt iOffsetToTotalPages;   
       
   142 	/** Offset to two digits for current page. */
       
   143 	TInt iOffsetToCurrentPage;   
       
   144 	};
       
   145 
       
   146 /**
       
   147 Packages fax header information for transferring across the client-server boundary. 
       
   148 
       
   149 @internalComponent
       
   150 */
       
   151 typedef TPckgBuf < TFaxHeaderInfo > TFaxHeaderInfoPckg;
       
   152 
       
   153 
       
   154 /**
       
   155 Read/write fax header line data
       
   156 
       
   157 Allows applications to read and write information from the fax header line 
       
   158 data file: including the header line template, a font bitmap, and character 
       
   159 offset information. This data can be used to generate a fax header line -
       
   160 which contains send-time information - in real time. 
       
   161 
       
   162 This class is not intended for user derivation.
       
   163 
       
   164 In pre-v5.1 releases of Symbian OS, this class was defined in faxstore.h and 
       
   165 had an import library faxst2.lib. 
       
   166 
       
   167 @publishedPartner
       
   168 @released
       
   169 */
       
   170 class CFaxHeaderLines : public CBase
       
   171 	{
       
   172 public:
       
   173 	IMPORT_C static CFaxHeaderLines * NewL ();
       
   174 	IMPORT_C static CFaxHeaderLines * NewLC ();
       
   175 	~CFaxHeaderLines ();
       
   176 
       
   177 	IMPORT_C void WriteRawFontLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine);
       
   178 	IMPORT_C void WriteRawHeaderLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine);
       
   179 	IMPORT_C void WriteFaxHeaderInfoL (TFaxHeaderInfo & aFaxHeaderInfo);
       
   180 	IMPORT_C void ReadRawFontLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine);
       
   181 	IMPORT_C void ReadRawHeaderLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine);
       
   182 	IMPORT_C void ReadFaxHeaderInfoL (TFaxHeaderInfo & aFaxHeaderInfo);
       
   183 	IMPORT_C static CFaxHeaderLines * NewLC (RFile* aHeaderFile);
       
   184 	IMPORT_C static void GeneratePathForHeaderFileL(TDes& aPrivatePath);
       
   185 
       
   186 protected:
       
   187 	CFaxHeaderLines(RFile* aHeaderFile);
       
   188 	CFaxHeaderLines();
       
   189 	void ConstructL ();
       
   190 	static void GenerateHeaderPathL(TDes& aPrivatePath);
       
   191 	inline RFile& File();
       
   192 
       
   193 private:
       
   194 	RFs iFileSession;
       
   195 	RFile iFile;
       
   196 	TInt iSeekpos;
       
   197 	TInt iLineNumber;
       
   198 	RFile* iAdoptedHeaderFile;
       
   199 	TBool iUseAdpotedFileHandle;
       
   200 
       
   201 public:
       
   202 	/** The fax header information package. */
       
   203 	TFaxHeaderInfoPckg iOurFaxHeaderInfoPckg;
       
   204 	};
       
   205 
       
   206 #endif // __CFAXIO_H__