|
1 /* |
|
2 * Copyright (c) 2008 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: Declaration of asynchronous text formatter. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef _CFSASYNCTEXTFORMATTER_H_ |
|
19 #define _CFSASYNCTEXTFORMATTER_H_ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 class CTextLayout; |
|
24 |
|
25 /** |
|
26 * Observer for informing about active object status. |
|
27 */ |
|
28 class MAsyncTextFormatterObserver |
|
29 { |
|
30 public: |
|
31 |
|
32 /** |
|
33 * Called when text formatting is complete. |
|
34 */ |
|
35 virtual void FormatAllTextComplete() = 0; |
|
36 |
|
37 /** |
|
38 * Called when text formatting was cancelled. |
|
39 */ |
|
40 virtual void FormatAllTextCancelled() = 0; |
|
41 }; |
|
42 |
|
43 /** |
|
44 * Asynchronous formatter of text from CTextLayout class. |
|
45 */ |
|
46 class CFSAsyncTextFormatter : public CActive |
|
47 { |
|
48 public: |
|
49 |
|
50 /** |
|
51 * NewL for two phase construction. |
|
52 */ |
|
53 static CFSAsyncTextFormatter* NewL(); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CFSAsyncTextFormatter(); |
|
59 |
|
60 /** |
|
61 * Starts active object (formatting). |
|
62 * @param aTextLayout pointer to text layout which content needs to be |
|
63 * formatted |
|
64 * @param aObserver observer which will be informed when formatting |
|
65 * finished or cancelled |
|
66 */ |
|
67 void StartFormatting( CTextLayout* aTextLayout, |
|
68 MAsyncTextFormatterObserver* aObserver ); |
|
69 |
|
70 private: |
|
71 |
|
72 /** |
|
73 * constructor. |
|
74 */ |
|
75 CFSAsyncTextFormatter(); |
|
76 |
|
77 /** |
|
78 * 2nd phase constructor can leave. |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 protected: // From CActive |
|
83 |
|
84 /** |
|
85 * From base class CActive |
|
86 * Handles an active object's request completion event. |
|
87 */ |
|
88 void RunL(); |
|
89 |
|
90 /** |
|
91 * From base class CActive |
|
92 * Implements cancellation of an outstanding request. |
|
93 */ |
|
94 void DoCancel(); |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Current position of formatted part of document. |
|
100 */ |
|
101 TInt iCurrentDocPos; |
|
102 |
|
103 /** |
|
104 * Observer which will be informed when formatting finished. |
|
105 * Not own. |
|
106 */ |
|
107 MAsyncTextFormatterObserver* iObserver; |
|
108 |
|
109 /** |
|
110 * Text layout which contains text to be formatted. |
|
111 * Not own. |
|
112 */ |
|
113 CTextLayout* iTextLayout; |
|
114 }; |
|
115 |
|
116 #endif /* _CFSASYNCTEXTFORMATTER_H_ */ |