equal
deleted
inserted
replaced
19 #include "FRMPAGE.H" |
19 #include "FRMPAGE.H" |
20 #include "FRMTLAY.H" |
20 #include "FRMTLAY.H" |
21 #include "FRMCONST.H" |
21 #include "FRMCONST.H" |
22 #include <txtlaydc.h> |
22 #include <txtlaydc.h> |
23 |
23 |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "FRMPAGETraces.h" |
|
27 #endif |
|
28 |
24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
29 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
25 #include "FRMCONST_INTERNAL.H" |
30 #include "FRMCONST_INTERNAL.H" |
26 #include "FRMCONST_PARTNER.H" |
31 #include "FRMCONST_PARTNER.H" |
27 #endif |
32 #endif |
28 |
33 |
89 beforehand. |
94 beforehand. |
90 |
95 |
91 @param aPrinterDevice The printer device. */ |
96 @param aPrinterDevice The printer device. */ |
92 EXPORT_C void CTextPaginator::SetPrinterDevice(CPrinterDevice* aPrinterDevice) |
97 EXPORT_C void CTextPaginator::SetPrinterDevice(CPrinterDevice* aPrinterDevice) |
93 { |
98 { |
|
99 if (!iLayout) |
|
100 { |
|
101 OstTrace0( TRACE_FATAL, CTEXTPAGINATOR_SETPRINTERDEVICE, "EFDocumentToPaginateNotSet" ); |
|
102 } |
94 __ASSERT_ALWAYS(iLayout,FormPanic(EFDocumentToPaginateNotSet)); |
103 __ASSERT_ALWAYS(iLayout,FormPanic(EFDocumentToPaginateNotSet)); |
95 iPrinterDevice=aPrinterDevice; |
104 iPrinterDevice=aPrinterDevice; |
96 iLayout->SetImageDeviceMap(aPrinterDevice); |
105 iLayout->SetImageDeviceMap(aPrinterDevice); |
97 |
106 |
98 iPageSizeInTwips=aPrinterDevice->CurrentPageSpecInTwips().OrientedPageSize(); |
107 iPageSizeInTwips=aPrinterDevice->CurrentPageSpecInTwips().OrientedPageSize(); |
166 together. |
175 together. |
167 |
176 |
168 Note: SetDocumentL() must have been called beforehand, or a panic occurs. */ |
177 Note: SetDocumentL() must have been called beforehand, or a panic occurs. */ |
169 EXPORT_C void CTextPaginator::PaginateCompleteDocumentL() |
178 EXPORT_C void CTextPaginator::PaginateCompleteDocumentL() |
170 { |
179 { |
|
180 if (!iLayout) |
|
181 { |
|
182 OstTrace0( TRACE_FATAL, CTEXTPAGINATOR_PAGINATECOMPLETEDOCUMENTL, "EFDocumentToPaginateNotSet" ); |
|
183 } |
171 __ASSERT_ALWAYS(iLayout,FormPanic(EFDocumentToPaginateNotSet)); |
184 __ASSERT_ALWAYS(iLayout,FormPanic(EFDocumentToPaginateNotSet)); |
172 if (iPageList->Count()==0) |
185 if (iPageList->Count()==0) |
173 iPageList->AppendL(iLayDoc->LdDocumentLength()); |
186 iPageList->AppendL(iLayDoc->LdDocumentLength()); |
174 if (!IsAdded()) |
187 if (!IsAdded()) |
175 CActiveScheduler::Add(this); // Adds itself to the active scheduler |
188 CActiveScheduler::Add(this); // Adds itself to the active scheduler |
194 given a value of zero. Returns the last document position which has been |
207 given a value of zero. Returns the last document position which has been |
195 paginated. |
208 paginated. |
196 @return A count of the current number of pages. */ |
209 @return A count of the current number of pages. */ |
197 EXPORT_C TInt CTextPaginator::AppendTextL(TInt& aCumulativeDocPos) |
210 EXPORT_C TInt CTextPaginator::AppendTextL(TInt& aCumulativeDocPos) |
198 { |
211 { |
|
212 if (!iLayout) |
|
213 { |
|
214 OstTrace0( TRACE_FATAL, CTEXTPAGINATOR_APPENDTEXTL, "EFDocumentToPaginateNotSet" ); |
|
215 } |
199 __ASSERT_ALWAYS(iLayout,FormPanic(EFDocumentToPaginateNotSet)); |
216 __ASSERT_ALWAYS(iLayout,FormPanic(EFDocumentToPaginateNotSet)); |
|
217 if (aCumulativeDocPos>=iLayout->DocumentLength()) |
|
218 { |
|
219 OstTrace0( TRACE_FATAL, DUP1_CTEXTPAGINATOR_APPENDTEXTL, "EFInvalidDocPos" ); |
|
220 } |
200 __ASSERT_ALWAYS(aCumulativeDocPos<iLayout->DocumentLength(),FormPanic(EFInvalidDocPos)); |
221 __ASSERT_ALWAYS(aCumulativeDocPos<iLayout->DocumentLength(),FormPanic(EFInvalidDocPos)); |
201 iMode=EFPaginateIncrementally; |
222 iMode=EFPaginateIncrementally; |
202 |
223 |
203 if (iPageList->Count()==0) |
224 if (iPageList->Count()==0) |
204 ResetPaginator(); |
225 ResetPaginator(); |
225 |
246 |
226 aCumulativeDocPos=iDocPos; |
247 aCumulativeDocPos=iDocPos; |
227 |
248 |
228 TRAPD(err,CopyTempPageListL()); |
249 TRAPD(err,CopyTempPageListL()); |
229 if (err) |
250 if (err) |
|
251 { |
230 LeaveL(err); |
252 LeaveL(err); |
|
253 } |
231 return iPageList->Count(); |
254 return iPageList->Count(); |
232 } |
255 } |
233 |
256 |
234 /** This function should be called when incremental pagination has completed |
257 /** This function should be called when incremental pagination has completed |
235 (see AppendTextL()), to complete the final entry in the page list. If an |
258 (see AppendTextL()), to complete the final entry in the page list. If an |
455 void CTextPaginator::CopyTempPageListL() |
478 void CTextPaginator::CopyTempPageListL() |
456 // |
479 // |
457 // Copies temp page list to one that external user sees |
480 // Copies temp page list to one that external user sees |
458 // |
481 // |
459 { |
482 { |
|
483 if (iTempPageList->Count()<1 && iMode!=EFPaginateIncrementally) |
|
484 { |
|
485 OstTrace0( TRACE_DUMP, CTEXTPAGINATOR_COPYTEMPPAGELISTL, "EFPageListEmpty" ); |
|
486 } |
460 __ASSERT_DEBUG(iTempPageList->Count()>=1||iMode==EFPaginateIncrementally,FormPanic(EFPageListEmpty)); |
487 __ASSERT_DEBUG(iTempPageList->Count()>=1||iMode==EFPaginateIncrementally,FormPanic(EFPageListEmpty)); |
461 TRAPD(err,iPageList->ResizeL(iTempPageList->Count())); |
488 TRAPD(err,iPageList->ResizeL(iTempPageList->Count())); |
462 if (err) |
489 if (err) |
463 LeaveL(err); |
490 LeaveL(err); |
464 |
491 |
484 iTempPageList->Compress(); |
511 iTempPageList->Compress(); |
485 |
512 |
486 if (iObserver) |
513 if (iObserver) |
487 iObserver->NotifyError(aErr); |
514 iObserver->NotifyError(aErr); |
488 |
515 |
|
516 OstTrace1( TRACE_FATAL, CTEXTPAGINATOR_LEAVEL, "CTextPaginator::LeaveL;aErr=%d", aErr ); |
|
517 |
489 User::Leave(aErr); |
518 User::Leave(aErr); |
490 } |
519 } |
491 |
520 |