1 /* |
|
2 * Copyright (c) 2003 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 the License "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: Applies CSS for the box tree |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCSSHANDLER_H |
|
21 #define CCSSHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "nw_css_processor.h" |
|
26 #include "nw_lmgr_boxvisitor.h" |
|
27 |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * This class applies the CSS styles to the box tree. |
|
43 * It breaks each box ApplyStyle into separate RunL |
|
44 * |
|
45 * @lib css.lib |
|
46 * @since 2.1 |
|
47 */ |
|
48 class CCSSHandler : public CActive |
|
49 { |
|
50 public: // Constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * @param aProcessor A pointer to processor object that owns this object |
|
55 * @return CCSSHandler* |
|
56 */ |
|
57 static CCSSHandler* NewL(NW_CSS_Processor_t* aProcessor); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CCSSHandler(); |
|
63 |
|
64 |
|
65 public: // New functions |
|
66 |
|
67 /** |
|
68 * This is called from the processor when a new stylesheet needs to be applied |
|
69 * @since 2.1 |
|
70 * @return void |
|
71 */ |
|
72 void ApplyStylesL(); |
|
73 |
|
74 public: // Functions from base classes |
|
75 |
|
76 /** |
|
77 * From CActive |
|
78 * @since 2.1 |
|
79 * @param |
|
80 * @return void |
|
81 */ |
|
82 void RunL(); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * From CActive Noop. |
|
88 * @since 2.1 |
|
89 * @param |
|
90 * @return void |
|
91 */ |
|
92 void DoCancel(); |
|
93 |
|
94 /** |
|
95 * C++ default constructor. |
|
96 * @param aProcessor A pointer to processor object that owns this object |
|
97 * @return CCSSHandler* |
|
98 */ |
|
99 CCSSHandler(NW_CSS_Processor_t* aProcessor); |
|
100 |
|
101 /** |
|
102 * By default Symbian 2nd phase constructor is private. |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 /** |
|
107 * This method applies styles to each box in the box tree and stores it as backup. |
|
108 * It is called from the RunL method. |
|
109 * @since 2.1 |
|
110 * @return ETrue if styles have been applied to all the boxes, otherwise EFalse |
|
111 */ |
|
112 TBool ApplyBoxStylesL(); |
|
113 |
|
114 /** |
|
115 * After the styles have been applied, this method replace the property list of all boxes |
|
116 * with the box backup property list, reformats the box tree and redraws it. Called from RunL |
|
117 * @since 2.1 |
|
118 * @return void |
|
119 */ |
|
120 void ApplyStylesCompleteL(); |
|
121 |
|
122 /** |
|
123 * This method swaps the property list of all boxes with the box backup property list |
|
124 * @since 2.1 |
|
125 * @return void |
|
126 */ |
|
127 void SwapPropListL(); |
|
128 |
|
129 /** |
|
130 * Gets the next box (using box visitor) which has the element node set up |
|
131 * @since 2.1 |
|
132 * @param (OUT) element node which has been set on the box |
|
133 * @return pointer to the next box |
|
134 */ |
|
135 NW_LMgr_Box_t* GetNextBox(NW_DOM_ElementNode_t** node); |
|
136 |
|
137 private: // Data |
|
138 |
|
139 // box visitor to visit each box of the box tree to which styles are applied |
|
140 NW_LMgr_BoxVisitor_t iBoxVisitor; |
|
141 // processor whose styles need to be applied |
|
142 NW_CSS_Processor_t* iProcessor; |
|
143 }; |
|
144 |
|
145 #endif // CCSSHandler |
|
146 |
|
147 // End of CSS |
|