|
1 // Copyright (c) 1997-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 */ |
|
20 |
|
21 #if !defined(__FAXSTORE_H__) |
|
22 #define __FAXSTORE_H__ |
|
23 |
|
24 #include <faxdefn.h> |
|
25 #include <cfaxio.h> |
|
26 |
|
27 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
28 #include <faxpageinfo.h> |
|
29 #endif |
|
30 |
|
31 class TFaxBandHeader; |
|
32 class CFaxPageInfo; |
|
33 class CFaxPages; |
|
34 |
|
35 /** |
|
36 Adds pages to a fax file. |
|
37 |
|
38 The class is used by first calling StartPage() to define the compression and |
|
39 resolution of the fax page, and then calling AddEncodedScanLineL() or AddScanLineL() |
|
40 to add each of the page's encoded or raw scan lines. When the page is complete, |
|
41 the EndPage() function adds the scan line compression, scan line resolution, |
|
42 and sender Id information to the store. |
|
43 |
|
44 In pre-v5.1 releases of Symbian OS, the import library was faxst2.lib. |
|
45 |
|
46 @publishedPartner |
|
47 @released |
|
48 */ |
|
49 class CWriteFaxPages : public CBase |
|
50 { |
|
51 protected: |
|
52 CWriteFaxPages(CStreamStore& aStore,TInt aMaxScanLinesInBand); |
|
53 void ConstructL(); |
|
54 TBool BandCompleted(); |
|
55 public: |
|
56 IMPORT_C static CWriteFaxPages* NewL(CStreamStore& aStore,TInt aMaxScanLinesInBand=0); |
|
57 IMPORT_C ~CWriteFaxPages(); |
|
58 IMPORT_C void StartPage(TFaxResolution aResolution, TFaxCompression aCompression, TInt aFlag2 = 0); |
|
59 IMPORT_C void EndPageL(TFaxResolution aResolution, TFaxBufSenderId& aSenderId, TFaxCompression aCompression = EModifiedHuffman, TInt aFlag2 = 0); |
|
60 IMPORT_C void AddScanLineL(const TDesC8& aScanline); |
|
61 IMPORT_C void AddEncodedScanLineL(const TDesC8& anEncodedScanLine); |
|
62 IMPORT_C TStreamId CommitPageL(); |
|
63 private: |
|
64 TInt iMaxScanLinesInBand; |
|
65 CFaxPages* iFaxPages; |
|
66 CFaxPageInfo* iCurrentPage; |
|
67 CStreamStore* iStore; |
|
68 CFaxT4* iFaxT4; |
|
69 RStoreWriteStream iWriteStream; |
|
70 TBuf8<KFaxT4MaxDesLength> iEncodedScanLine; |
|
71 }; |
|
72 |
|
73 /** |
|
74 Creates and open a fax file for writing. |
|
75 |
|
76 The class provides the functionality to create a fax file, to commit pages |
|
77 to the fax file, to abort and delete the file, and to close the file. The |
|
78 ability to add individual fax pages to the store is provided through the CWriteFaxPages |
|
79 data member, which is created when the file is opened. |
|
80 |
|
81 In pre-v5.1 releases of Symbian OS, the import library was faxst2.lib. |
|
82 |
|
83 @publishedPartner |
|
84 @released |
|
85 */ |
|
86 class CWriteFaxFile : public CBase |
|
87 { |
|
88 protected: |
|
89 CWriteFaxFile(); |
|
90 void ConstructL(); |
|
91 void DoOpenL(TInt aMaxScanLinesInBand); |
|
92 public: |
|
93 IMPORT_C static CWriteFaxFile* NewL(); |
|
94 IMPORT_C ~CWriteFaxFile(); |
|
95 IMPORT_C void OpenL(const TDesC& aFileName,TInt aMaxScanLinesInBand); |
|
96 IMPORT_C void CommitL(); |
|
97 IMPORT_C void Close(); |
|
98 IMPORT_C void AbortWrite(); // deletes file, called by OpenL() and CloseL() if they leave |
|
99 private: |
|
100 TFileName iFileName; |
|
101 RFs iFs; |
|
102 CDirectFileStore* iFileStore; |
|
103 public: |
|
104 /** A pointer to the object which can be used to add pages to the file. Memory |
|
105 is allocated for the object when the file is opened. */ |
|
106 CWriteFaxPages* iWriteFaxPages; |
|
107 }; |
|
108 |
|
109 /** |
|
110 Fax page information read from a file. |
|
111 |
|
112 Stores fax page information which is read from a fax file - see CReadFaxPages::CurrentPageInfo(). |
|
113 |
|
114 @publishedPartner |
|
115 @released |
|
116 */ |
|
117 class TFaxPageInfo |
|
118 { |
|
119 public: |
|
120 /** The number of scan lines. */ |
|
121 TInt iNumScanLines; |
|
122 /** The fax page resolution. */ |
|
123 TFaxResolution iResolution; |
|
124 /** The sender Id. */ |
|
125 TFaxBufSenderId iSenderId; |
|
126 /** The fax page encoding. */ |
|
127 TFaxCompression iCompression; // was TInt iReservedFlag1 up to faxstore 013 |
|
128 TInt iReservedFlag2; |
|
129 }; |
|
130 |
|
131 /** |
|
132 Reads individual pages from a fax file. |
|
133 |
|
134 The class provides functions to get the number of fax pages in a fax store, |
|
135 the number of scan lines per page, information about the scan line compression |
|
136 and resolution, and the sender Id. It is then possible to iterate through |
|
137 the store by page and by scan line to obtain the fax page. |
|
138 |
|
139 In pre-v5.1 releases of Symbian OS, the import library was faxst2.lib. |
|
140 |
|
141 @publishedPartner |
|
142 @released |
|
143 */ |
|
144 class CReadFaxPages : public CBase |
|
145 { |
|
146 protected: |
|
147 CReadFaxPages(CStreamStore& aStore); |
|
148 void ConstructL(TStreamId aStreamId); |
|
149 public: |
|
150 IMPORT_C static CReadFaxPages* NewL(CStreamStore& aStore,TStreamId aStreamId); |
|
151 IMPORT_C ~CReadFaxPages(); |
|
152 IMPORT_C TInt NumPages() const; |
|
153 IMPORT_C void SetPageL(TInt aNum); |
|
154 IMPORT_C TFaxPageInfo CurrentPageInfo() const; |
|
155 IMPORT_C void SeekScanLineL(TInt anIndex); |
|
156 IMPORT_C TInt GetScanLineL(TDes8& aScanLine); |
|
157 IMPORT_C void GetEncodedScanLineL(TDes8& anEncodedScanLine); |
|
158 protected: |
|
159 void SetBandL(TInt anIndex); |
|
160 private: |
|
161 TInt iBandIndex; |
|
162 TInt iScanLineOffset; |
|
163 CFaxPages* iFaxPages; |
|
164 CFaxPageInfo* iCurrentPage; |
|
165 CStreamStore* iStore; |
|
166 CFaxT4* iFaxT4; |
|
167 RStoreReadStream iReadStream; |
|
168 TBuf8<KFaxT4MaxDesLength> iEncodedScanLine; |
|
169 }; |
|
170 |
|
171 /** |
|
172 Opens a fax file for reading. |
|
173 |
|
174 The class provides the functionality to open and close a fax file. The ability |
|
175 to read individual fax pages is provided by the CReadFaxPages data member, |
|
176 which is created when the file is opened. |
|
177 |
|
178 In pre-v5.1 versions of Symbian OS, the import library was faxst2.lib. |
|
179 |
|
180 @publishedPartner |
|
181 @released |
|
182 */ |
|
183 class CReadFaxFile : public CBase |
|
184 { |
|
185 protected: |
|
186 CReadFaxFile(); |
|
187 void ConstructL(); |
|
188 void DoOpenL(const TDesC& aFileName); |
|
189 public: |
|
190 IMPORT_C static CReadFaxFile* NewL(); |
|
191 IMPORT_C ~CReadFaxFile(); |
|
192 IMPORT_C void OpenL(const TDesC& aFileName); |
|
193 IMPORT_C void Close(); |
|
194 private: |
|
195 RFs iFs; |
|
196 CDirectFileStore* iFileStore; |
|
197 public: |
|
198 /** A pointer to the object which can be used to access the fax pages stored in |
|
199 the file. Memory is allocated for the object when the fax file is opened. */ |
|
200 CReadFaxPages* iReadFaxPages; |
|
201 }; |
|
202 |
|
203 // now the TFaxHeaderInfo and CFaxHeaderLines classes |
|
204 // for saving/restoring fax headers |
|
205 // used by fax client and fax server |
|
206 /* |
|
207 class TFaxHeaderInfo |
|
208 { |
|
209 public: |
|
210 TInt iHeaderFontWidthInBytes; // width of font in bytes |
|
211 TInt iHeaderFontHeightInLines;// height of font in lines |
|
212 TInt iOffsetToDay; // offset to two digit day of month |
|
213 TInt iOffsetToMonth; // offset to two digits month of year |
|
214 TInt iOffsetToYear; // offset to four digits year |
|
215 TInt iOffsetToHour; // offset to two digits hour (24 hour clock) |
|
216 TInt iOffsetToMinute; // offset to two digits minute |
|
217 TInt iOffsetToTotalPages; // offset to two digits for total pages |
|
218 TInt iOffsetToCurrentPage; // offset to two digits for current page |
|
219 }; |
|
220 |
|
221 typedef TPckgBuf < TFaxHeaderInfo > TFaxHeaderInfoPckg; |
|
222 |
|
223 class CFaxHeaderLines : public CBase |
|
224 { |
|
225 public: |
|
226 IMPORT_C static CFaxHeaderLines * NewL(); |
|
227 IMPORT_C static CFaxHeaderLines * NewLC(); |
|
228 ~CFaxHeaderLines (); |
|
229 |
|
230 IMPORT_C void WriteRawFontLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine); |
|
231 IMPORT_C void WriteRawHeaderLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine); |
|
232 IMPORT_C void WriteFaxHeaderInfoL (TFaxHeaderInfo & aFaxHeaderInfo); |
|
233 IMPORT_C void ReadRawFontLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine); |
|
234 IMPORT_C void ReadRawHeaderLineL (const TInt alineNumber,TRawScanLine & aUncompressedDataLine); |
|
235 IMPORT_C void ReadFaxHeaderInfoL (TFaxHeaderInfo & aFaxHeaderInfo); |
|
236 |
|
237 protected: |
|
238 void ConstructL(); |
|
239 |
|
240 private: |
|
241 RFs iFileSession; |
|
242 RFile iFile; |
|
243 TInt iSeekpos; |
|
244 TInt iLineNumber; |
|
245 |
|
246 public: |
|
247 TFaxHeaderInfoPckg iOurFaxHeaderInfoPckg; |
|
248 };*/ |
|
249 |
|
250 #endif |