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