|
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 "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: SVG Implementation header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _INC_CSVGTEXTAREAELEMENTIMPL_ |
|
20 #define _INC_CSVGTEXTAREAELEMENTIMPL_ |
|
21 |
|
22 #include "SVGElementImpl.h" |
|
23 #include "GfxFloatFixPt.h" |
|
24 #include "GfxRoundRectangle2D.h" |
|
25 #include "SVGListener.h" |
|
26 |
|
27 class CSvgDocumentImpl; |
|
28 class CSvgRectElementImpl; |
|
29 class CSvgTextElementImpl; |
|
30 class CSvgLineElementImpl; |
|
31 |
|
32 /** |
|
33 * Class description goes here. |
|
34 * |
|
35 * @lib SVGEngine.lib |
|
36 * @since 1.0 |
|
37 */ |
|
38 class CSvgTextAreaElementImpl : public CSvgElementImpl, |
|
39 public MSvgMouseListener |
|
40 { |
|
41 public: |
|
42 |
|
43 // Constructor/deconstructor |
|
44 |
|
45 /** |
|
46 * Need method description |
|
47 * |
|
48 * @since 1.0 |
|
49 * @param |
|
50 * @return |
|
51 */ |
|
52 static CSvgTextAreaElementImpl*NewL( const TUint8 aElemID, |
|
53 CSvgDocumentImpl* aDoc ); |
|
54 |
|
55 /** |
|
56 * Need method description |
|
57 * |
|
58 * @since 1.0 |
|
59 * @param |
|
60 * @return |
|
61 */ |
|
62 static CSvgTextAreaElementImpl*NewLC( const TUint8 aElemID, |
|
63 CSvgDocumentImpl* aDoc ); |
|
64 |
|
65 /** |
|
66 * Need method description |
|
67 * |
|
68 * @since 1.0 |
|
69 * @param |
|
70 * @return |
|
71 */ |
|
72 virtual ~CSvgTextAreaElementImpl(); |
|
73 |
|
74 // From SVG DOM |
|
75 /** |
|
76 * Need method description |
|
77 * |
|
78 * @since 1.0 |
|
79 * @param |
|
80 * @return |
|
81 */ |
|
82 MXmlElement* CloneL(MXmlElement* aParentElement); |
|
83 |
|
84 /** |
|
85 * Need method description |
|
86 * |
|
87 * @since 1.0 |
|
88 * @param |
|
89 * @return |
|
90 */ |
|
91 TFloatFixPt X(); |
|
92 |
|
93 /** |
|
94 * Need method description |
|
95 * |
|
96 * @since 1.0 |
|
97 * @param |
|
98 * @return |
|
99 */ |
|
100 TFloatFixPt Y(); |
|
101 TInt GetLength(); |
|
102 /** |
|
103 * Need method description |
|
104 * |
|
105 * @since 1.0 |
|
106 * @param |
|
107 * @return |
|
108 */ |
|
109 TFloatFixPt Width(); |
|
110 |
|
111 /** |
|
112 * Need method description |
|
113 * |
|
114 * @since 1.0 |
|
115 * @param |
|
116 * @return |
|
117 */ |
|
118 TFloatFixPt Height(); |
|
119 |
|
120 /** |
|
121 * Need method description |
|
122 * |
|
123 * @since 1.0 |
|
124 * @param |
|
125 * @return |
|
126 */ |
|
127 TFloatFixPt Rx(); |
|
128 |
|
129 /** |
|
130 * Need method description |
|
131 * |
|
132 * @since 1.0 |
|
133 * @param |
|
134 * @return |
|
135 */ |
|
136 TFloatFixPt Ry(); |
|
137 |
|
138 // SVG Implementation |
|
139 /** |
|
140 * Need method description |
|
141 * |
|
142 * @since 1.0 |
|
143 * @param |
|
144 * @return |
|
145 */ |
|
146 TInt GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue ); |
|
147 |
|
148 /** |
|
149 * Need method description |
|
150 * |
|
151 * @since 1.0 |
|
152 * @param |
|
153 * @return |
|
154 */ |
|
155 TInt SetAttributeFloatL( const TInt aNameId, const TFloatFixPt aValue ); |
|
156 |
|
157 TInt SetAttributeDesL( const TInt aNameId, const TDesC& aValue ); |
|
158 |
|
159 TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue ); |
|
160 |
|
161 // From MXmlElement API |
|
162 /** |
|
163 * Need method description |
|
164 * |
|
165 * @since 1.0 |
|
166 * @param |
|
167 * @return |
|
168 */ |
|
169 TInt SetAttributeL( const TDesC& aName, const TDesC& aValue ); |
|
170 |
|
171 void SetEditable( const TDesC& aValue ); |
|
172 |
|
173 /** |
|
174 * Need method description |
|
175 * |
|
176 * @since 1.0 |
|
177 * @param |
|
178 * @return |
|
179 */ |
|
180 TBool DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement ); |
|
181 |
|
182 |
|
183 TBool DrawTextElements( CGfx2dGc* aGc, CSvgElementImpl* aElement ); |
|
184 |
|
185 /** |
|
186 * Need method description |
|
187 * |
|
188 * @since 1.0 |
|
189 * @param |
|
190 * @return |
|
191 */ |
|
192 void GetBBox( TGfxRectangle2D& aBbox ); |
|
193 |
|
194 /** |
|
195 * Need method description |
|
196 * |
|
197 * @since 1.0 |
|
198 * @param |
|
199 * @return |
|
200 */ |
|
201 virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ ); |
|
202 |
|
203 /** |
|
204 * Need method description |
|
205 * |
|
206 * @since 1.0 |
|
207 * @param |
|
208 * @return |
|
209 */ |
|
210 void SetTextAreaDimensions(TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight); |
|
211 |
|
212 void SetTextL( const TDesC& aText ); // This is temporary API until CDATA is implemented |
|
213 |
|
214 void GetText( TDes& allText ); |
|
215 |
|
216 TBool IsEditable( ); |
|
217 |
|
218 void LocalizedArrangeTextL( CGfx2dGc* aGc ); |
|
219 |
|
220 void RemoveText( const TDesC& aString ); |
|
221 |
|
222 void InitializeL( ); |
|
223 |
|
224 /** |
|
225 * Return wether an svg element is displayable, such as <rect>, <circle>, or |
|
226 * an abstract element, such as <g>, <animate>. |
|
227 * |
|
228 * @since 1.0 |
|
229 * @param None |
|
230 * @return ETrue if element is viewable. |
|
231 */ |
|
232 TBool IsViewable() { return ETrue; } |
|
233 |
|
234 /** |
|
235 * Notified when the mouse pointer enters a visible svg element. |
|
236 * |
|
237 * @since 1.0 |
|
238 * param : aElements -- SVG elements containing the mouse point. |
|
239 * param : aX -- x coordinate of mouse pointer. |
|
240 * param : aY -- y coordinate of mouse pointer. |
|
241 * @return : For future use. Value is ignored. |
|
242 */ |
|
243 TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements, |
|
244 TInt aX, TInt aY ); |
|
245 |
|
246 /** |
|
247 * Notified when the mouse pointer exits a visible svg element. |
|
248 * |
|
249 * @since 1.0 |
|
250 * param : aElements -- SVG elements containing the mouse point. |
|
251 * param : aX -- x coordinate of mouse pointer. |
|
252 * param : aY -- y coordinate of mouse pointer. |
|
253 * @return : For future use. Value is ignored. |
|
254 */ |
|
255 TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements, |
|
256 TInt aX, TInt aY ); |
|
257 |
|
258 /** |
|
259 * Notified when the mouse pointer exits a visible svg element. |
|
260 * |
|
261 * @since 1.0 |
|
262 * param : aElements -- SVG elements containing the mouse point. |
|
263 * param : aX -- x coordinate of mouse pointer. |
|
264 * param : aY -- y coordinate of mouse pointer. |
|
265 * @return : For future use. Value is ignored. |
|
266 */ |
|
267 TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements, |
|
268 TInt aX, TInt aY ); |
|
269 |
|
270 /** |
|
271 * Notified when the mouse pointer is pressed down on visible svg element. |
|
272 * |
|
273 * @since 1.0 |
|
274 * param : aElements -- SVG elements containing the mouse point. |
|
275 * param : aX -- x coordinate of mouse pointer. |
|
276 * param : aY -- y coordinate of mouse pointer. |
|
277 * @return : For future use. Value is ignored. |
|
278 */ |
|
279 TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements, |
|
280 TInt aX, TInt aY ); |
|
281 |
|
282 /** |
|
283 * Notified when the mouse pointer is released on on visible svg element. |
|
284 * |
|
285 * @since 1.0 |
|
286 * param : aElements -- SVG elements containing the mouse point. |
|
287 * param : aX -- x coordinate of mouse pointer. |
|
288 * param : aY -- y coordinate of mouse pointer. |
|
289 * @return : For future use. Value is ignored. |
|
290 */ |
|
291 TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements, |
|
292 TInt aX, TInt aY ); |
|
293 inline TInt FileOffset() const |
|
294 { |
|
295 return iOffset; |
|
296 } |
|
297 |
|
298 inline void SetFileOffset(TInt aOffset) |
|
299 { |
|
300 if( !FileOffset() ) |
|
301 iOffset = aOffset; |
|
302 }; |
|
303 |
|
304 inline void SetOrgLength(TInt aOrgLength) |
|
305 { |
|
306 if(! GetOrgLength()) |
|
307 iOrgLength = aOrgLength; |
|
308 }; |
|
309 |
|
310 inline TInt GetOrgLength() |
|
311 { |
|
312 return iOrgLength; |
|
313 } |
|
314 |
|
315 void Print( TBool aIsEncodeOn ); |
|
316 |
|
317 private: |
|
318 |
|
319 /** |
|
320 * Need method description |
|
321 * |
|
322 * @since 1.0 |
|
323 * @param |
|
324 * @return |
|
325 */ |
|
326 void ConstructL( const TUint8 aElemID ); |
|
327 |
|
328 /** |
|
329 * Need method description |
|
330 * |
|
331 * @since 1.0 |
|
332 * @param |
|
333 * @return |
|
334 */ |
|
335 CSvgTextAreaElementImpl( CSvgDocumentImpl* aDoc ); |
|
336 |
|
337 private: |
|
338 CSvgRectElementImpl* iInnerRectangle; |
|
339 CSvgRectElementImpl* iBorderRectangle; |
|
340 |
|
341 HBufC* iAllText; |
|
342 RPointerArray<CSvgTextElementImpl>* iTextElementsArray; |
|
343 |
|
344 TBool iEditable; |
|
345 TBool iInitialized; |
|
346 TBool iNeedTextRearrange; |
|
347 |
|
348 TInt iCursorPosition; |
|
349 CSvgLineElementImpl* iCursorElement; |
|
350 TGfxRectangle2D iLastBBox; |
|
351 //TBool iScrollBar; |
|
352 //TInt iScrollLocation; |
|
353 public: |
|
354 TInt iOffset; |
|
355 TInt iOrgLength; |
|
356 |
|
357 protected: |
|
358 |
|
359 /** |
|
360 * Need method description |
|
361 * |
|
362 * @since 1.0 |
|
363 * @param |
|
364 * @return |
|
365 */ |
|
366 void CopyL( CSvgTextAreaElementImpl* aDestElement ); |
|
367 |
|
368 }; |
|
369 |
|
370 #endif /* _INC_CSVGLINEELEMENT_3C61A6080051_INCLUDED */ |