Initial commit.
[pdfium.git] / fpdfsdk / src / pdfwindow / PWL_Utils.cpp
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4  \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #include "../../include/pdfwindow/PDFWindow.h"\r
8 #include "../../include/pdfwindow/PWL_Wnd.h"\r
9 #include "../../include/pdfwindow/PWL_Utils.h"\r
10 #include "../../include/pdfwindow/PWL_Icon.h"\r
11 \r
12 #define IsFloatZero(f)                                          ((f) < 0.0001 && (f) > -0.0001)\r
13 #define IsFloatBigger(fa,fb)                            ((fa) > (fb) && !IsFloatZero((fa) - (fb)))\r
14 #define IsFloatSmaller(fa,fb)                           ((fa) < (fb) && !IsFloatZero((fa) - (fb)))\r
15 #define IsFloatEqual(fa,fb)                                     IsFloatZero((fa)-(fb))\r
16 \r
17 /* ---------------------------- CPWL_Utils ------------------------------ */\r
18 \r
19 CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, FX_INT32 nCount)\r
20 {\r
21         CFX_ByteTextBuf csAP;\r
22 \r
23         for (FX_INT32 i=0; i<nCount; i++)\r
24         {\r
25                 switch (pPathData[i].type)\r
26                 {\r
27                 case PWLPT_MOVETO:\r
28                         csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " m\n";\r
29                         break;\r
30                 case PWLPT_LINETO:\r
31                         csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " l\n";\r
32                         break;\r
33                 case PWLPT_BEZIERTO:\r
34                         csAP << pPathData[i].point.x << " " << pPathData[i].point.y << " "\r
35                                  << pPathData[i+1].point.x << " " << pPathData[i+1].point.y << " "\r
36                                  << pPathData[i+2].point.x << " " << pPathData[i+2].point.y << " c\n";\r
37 \r
38                         i += 2;\r
39                         break;\r
40                 default:\r
41                         break;\r
42                 }\r
43         }\r
44 \r
45         return csAP.GetByteString();\r
46 }\r
47 \r
48 void CPWL_Utils::GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* pPathData, FX_INT32 nCount)\r
49 {\r
50         path.SetPointCount(nCount);\r
51 \r
52         for (FX_INT32 i=0; i<nCount; i++)\r
53         {\r
54                 switch (pPathData[i].type)\r
55                 {\r
56                 case PWLPT_MOVETO:\r
57                         path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y, FXPT_MOVETO);\r
58                         break;\r
59                 case PWLPT_LINETO:\r
60                         path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y, FXPT_LINETO);\r
61                         break;\r
62                 case PWLPT_BEZIERTO:\r
63                         path.SetPoint(i, pPathData[i].point.x, pPathData[i].point.y, FXPT_BEZIERTO);\r
64                         break;\r
65                 default:\r
66                         break;\r
67                 }\r
68         }\r
69 }\r
70 \r
71 \r
72 CPDF_Rect CPWL_Utils::MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2)\r
73 {\r
74         CPDF_Rect rcRet;\r
75 \r
76         rcRet.left = PWL_MIN(rect1.left,rect2.left);\r
77         rcRet.bottom = PWL_MIN(rect1.bottom,rect2.bottom);\r
78         rcRet.right = PWL_MAX(rect1.right,rect2.right);\r
79         rcRet.top = PWL_MAX(rect1.top,rect2.top);\r
80 \r
81         return rcRet;\r
82 }\r
83 \r
84 CPDF_Rect CPWL_Utils::OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y)\r
85 {\r
86         return CPDF_Rect(rect.left + x,rect.bottom + y,\r
87                 rect.right + x,rect.top + y);\r
88 }\r
89 \r
90 FX_BOOL CPWL_Utils::ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild)\r
91 {\r
92         return rcChild.left >= rcParent.left && rcChild.bottom >= rcParent.bottom &&\r
93                         rcChild.right <= rcParent.right && rcChild.top <= rcParent.top;\r
94 }\r
95 \r
96 FX_BOOL CPWL_Utils::IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2)\r
97 {\r
98         FX_FLOAT left = rect1.left > rect2.left ? rect1.left : rect2.left;\r
99         FX_FLOAT right = rect1.right < rect2.right ? rect1.right : rect2.right;\r
100         FX_FLOAT bottom = rect1.bottom > rect2.bottom ? rect1.bottom : rect2.bottom;\r
101         FX_FLOAT top = rect1.top < rect2.top ? rect1.top : rect2.top;\r
102 \r
103         return left < right && bottom < top;\r
104 }\r
105 \r
106 CPDF_Point CPWL_Utils::OffsetPoint(const CPDF_Point& point,FX_FLOAT x,FX_FLOAT y)\r
107 {\r
108         return CPDF_Point(point.x + x,point.y + y);\r
109 }\r
110 \r
111 CPVT_WordRange CPWL_Utils::OverlapWordRange(const CPVT_WordRange & wr1, const CPVT_WordRange & wr2)\r
112 {\r
113         CPVT_WordRange wrRet;\r
114 \r
115         if (wr2.EndPos.WordCmp(wr1.BeginPos) < 0 || wr2.BeginPos.WordCmp(wr1.EndPos) > 0) return wrRet;\r
116         if (wr1.EndPos.WordCmp(wr2.BeginPos) < 0 || wr1.BeginPos.WordCmp(wr2.EndPos) > 0) return wrRet;\r
117 \r
118         if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0)\r
119         {\r
120                 wrRet.BeginPos = wr2.BeginPos;\r
121         }\r
122         else\r
123         {\r
124                 wrRet.BeginPos = wr1.BeginPos;\r
125         }\r
126 \r
127         if (wr1.EndPos.WordCmp(wr2.EndPos) < 0)\r
128         {\r
129                 wrRet.EndPos = wr1.EndPos;\r
130         }\r
131         else\r
132         {\r
133                 wrRet.EndPos = wr2.EndPos;\r
134         }\r
135 \r
136         return wrRet;\r
137 }\r
138 \r
139 CFX_ByteString CPWL_Utils::GetAP_Check(const CPDF_Rect & crBBox)\r
140 {\r
141         CFX_ByteTextBuf csAP;\r
142 \r
143         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
144         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
145 \r
146         const FX_INT32 num = 8;\r
147 \r
148         CPWL_Point pts[num*3] = \r
149         {\r
150                 //1\r
151                 CPWL_Point(0.28f, 0.52f), \r
152                 CPWL_Point(0.27f, 0.48f),\r
153                 CPWL_Point(0.29f, 0.40f),\r
154 \r
155                 //2\r
156                 CPWL_Point(0.30f, 0.33f), \r
157                 CPWL_Point(0.31f, 0.29f),\r
158                 CPWL_Point(0.31f, 0.28f),\r
159 \r
160                 //3\r
161                 CPWL_Point(0.39f, 0.28f), \r
162                 CPWL_Point(0.49f, 0.29f),\r
163                 CPWL_Point(0.77f, 0.67f),\r
164 \r
165                 //4\r
166                 CPWL_Point(0.76f, 0.68f), \r
167                 CPWL_Point(0.78f, 0.69f),\r
168                 CPWL_Point(0.76f, 0.75f),\r
169 \r
170                 //5\r
171                 CPWL_Point(0.76f, 0.75f), \r
172                 CPWL_Point(0.73f, 0.80f),\r
173                 CPWL_Point(0.68f, 0.75f),\r
174 \r
175                 //6\r
176                 CPWL_Point(0.68f, 0.74f), \r
177                 CPWL_Point(0.68f, 0.74f),\r
178                 CPWL_Point(0.44f, 0.47f),\r
179 \r
180                 //7\r
181                 CPWL_Point(0.43f, 0.47f), \r
182                 CPWL_Point(0.40f, 0.47f),\r
183                 CPWL_Point(0.41f, 0.58f),\r
184 \r
185                 //8\r
186                 CPWL_Point(0.40f, 0.60f), \r
187                 CPWL_Point(0.28f, 0.66f),\r
188                 CPWL_Point(0.30f, 0.56f)\r
189         };\r
190 \r
191         for (FX_INT32 j=0; j<num*3; j++)\r
192         {\r
193                 pts[j].x *= fWidth;\r
194                 pts[j].x += crBBox.left;\r
195 \r
196                 pts[j].y *= fHeight;\r
197                 pts[j].y += crBBox.bottom;\r
198         }\r
199 \r
200         csAP << pts[0].x << " " << pts[0].y << " m\n";\r
201 \r
202         for (FX_INT32 i=0; i<num; i++)\r
203         {\r
204                 FX_INT32 nCur = i*3;\r
205                 FX_INT32 n1 = i*3 + 1;\r
206                 FX_INT32 n2 = i*3 + 2;\r
207                 FX_INT32 nNext = (i < num-1 ? (i+1)*3 : 0);\r
208 \r
209                 FX_FLOAT px1 = pts[n1].x - pts[nCur].x;\r
210                 FX_FLOAT py1 = pts[n1].y - pts[nCur].y;\r
211                 FX_FLOAT px2 = pts[n2].x - pts[nNext].x;\r
212                 FX_FLOAT py2 = pts[n2].y - pts[nNext].y;\r
213 \r
214                 csAP << pts[nCur].x + px1 * PWL_BEZIER << " " << pts[nCur].y + py1 * PWL_BEZIER << " " \r
215                         << pts[nNext].x + px2 * PWL_BEZIER << " " << pts[nNext].y + py2 * PWL_BEZIER << " "\r
216                         << pts[nNext].x << " " << pts[nNext].y << " c\n";\r
217         }\r
218 \r
219         return csAP.GetByteString();\r
220 }\r
221 \r
222 CFX_ByteString CPWL_Utils::GetAP_Circle(const CPDF_Rect & crBBox)\r
223 {\r
224         CFX_ByteTextBuf csAP;\r
225 \r
226         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
227         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
228 \r
229         CPDF_Point pt1(crBBox.left,crBBox.bottom + fHeight / 2);\r
230         CPDF_Point pt2(crBBox.left + fWidth / 2,crBBox.top);\r
231         CPDF_Point pt3(crBBox.right,crBBox.bottom + fHeight / 2);\r
232         CPDF_Point pt4(crBBox.left + fWidth / 2,crBBox.bottom);\r
233 \r
234         csAP << pt1.x << " " << pt1.y << " m\n";\r
235 \r
236         FX_FLOAT px = pt2.x - pt1.x;\r
237         FX_FLOAT py = pt2.y - pt1.y;\r
238 \r
239         csAP << pt1.x << " " << pt1.y + py * PWL_BEZIER << " " \r
240                 << pt2.x - px * PWL_BEZIER << " " << pt2.y << " "\r
241                 << pt2.x << " " << pt2.y << " c\n";\r
242 \r
243         px = pt3.x - pt2.x;\r
244         py = pt2.y - pt3.y;\r
245 \r
246         csAP << pt2.x + px * PWL_BEZIER << " " << pt2.y << " " \r
247                 << pt3.x << " " << pt3.y + py * PWL_BEZIER << " "\r
248                 << pt3.x << " " << pt3.y << " c\n";\r
249 \r
250         px = pt3.x - pt4.x;\r
251         py = pt3.y - pt4.y;\r
252 \r
253         csAP << pt3.x << " " << pt3.y - py * PWL_BEZIER << " " \r
254                 << pt4.x + px * PWL_BEZIER << " " << pt4.y << " "\r
255                 << pt4.x << " " << pt4.y << " c\n";\r
256 \r
257         px = pt4.x - pt1.x;\r
258         py = pt1.y - pt4.y;\r
259 \r
260         csAP << pt4.x - px * PWL_BEZIER << " " << pt4.y << " " \r
261                 << pt1.x << " " << pt1.y - py * PWL_BEZIER << " "\r
262                 << pt1.x << " " << pt1.y << " c\n";\r
263 \r
264         return csAP.GetByteString();\r
265 }\r
266 \r
267 CFX_ByteString CPWL_Utils::GetAP_Cross(const CPDF_Rect & crBBox)\r
268 {\r
269         CFX_ByteTextBuf csAP;\r
270 \r
271         csAP << crBBox.left << " " << crBBox.top << " m\n";\r
272         csAP << crBBox.right << " " << crBBox.bottom << " l\n";\r
273         csAP << crBBox.left << " " << crBBox.bottom << " m\n";\r
274         csAP << crBBox.right << " " << crBBox.top << " l\n";\r
275 \r
276         return csAP.GetByteString();\r
277 }\r
278 \r
279 CFX_ByteString CPWL_Utils::GetAP_Diamond(const CPDF_Rect & crBBox)\r
280 {\r
281         CFX_ByteTextBuf csAP;\r
282 \r
283         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
284         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
285 \r
286         CPDF_Point pt1(crBBox.left,crBBox.bottom + fHeight / 2);\r
287         CPDF_Point pt2(crBBox.left + fWidth / 2,crBBox.top);\r
288         CPDF_Point pt3(crBBox.right,crBBox.bottom + fHeight / 2);\r
289         CPDF_Point pt4(crBBox.left + fWidth / 2,crBBox.bottom);\r
290         \r
291         csAP << pt1.x << " " << pt1.y << " m\n";\r
292         csAP << pt2.x << " " << pt2.y << " l\n";\r
293         csAP << pt3.x << " " << pt3.y << " l\n";\r
294         csAP << pt4.x << " " << pt4.y << " l\n";\r
295         csAP << pt1.x << " " << pt1.y << " l\n";\r
296 \r
297         return csAP.GetByteString();\r
298 }\r
299 \r
300 CFX_ByteString CPWL_Utils::GetAP_Square(const CPDF_Rect & crBBox)\r
301 {\r
302         CFX_ByteTextBuf csAP;\r
303 \r
304         csAP << crBBox.left << " " << crBBox.top << " m\n";\r
305         csAP << crBBox.right << " " << crBBox.top << " l\n";\r
306         csAP << crBBox.right << " " << crBBox.bottom << " l\n";\r
307         csAP << crBBox.left << " " << crBBox.bottom << " l\n";\r
308         csAP << crBBox.left << " " << crBBox.top << " l\n";\r
309 \r
310         return csAP.GetByteString();\r
311 }\r
312 \r
313 CFX_ByteString CPWL_Utils::GetAP_Star(const CPDF_Rect & crBBox)\r
314 {\r
315         CFX_ByteTextBuf csAP;\r
316 \r
317         FX_FLOAT fRadius = (crBBox.top - crBBox.bottom)/(1+(FX_FLOAT)cos(PWL_PI/5.0f));\r
318         CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(crBBox.top + crBBox.bottom) / 2.0f);\r
319         \r
320         FX_FLOAT px[5],py[5];\r
321 \r
322         FX_FLOAT fAngel = PWL_PI/10.0f;\r
323 \r
324         for (FX_INT32 i=0; i<5; i++)\r
325         {\r
326                 px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel);\r
327                 py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel);\r
328 \r
329                 fAngel += PWL_PI * 2 / 5.0f;\r
330         }\r
331 \r
332         csAP << px[0] << " " << py[0] << " m\n";\r
333 \r
334         FX_INT32 nNext = 0;\r
335         for (FX_INT32 j=0; j<5; j++)\r
336         {\r
337                 nNext += 2;\r
338                 if (nNext >= 5) nNext -= 5;\r
339                 csAP << px[nNext] << " " << py[nNext] << " l\n";\r
340         }\r
341 \r
342         return csAP.GetByteString();\r
343 }\r
344 \r
345 CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fRotate)\r
346 {\r
347         CFX_ByteTextBuf csAP;\r
348 \r
349         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
350         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
351 \r
352         CPDF_Point pt1(-fWidth/2,0);\r
353         CPDF_Point pt2(0,fHeight/2);\r
354         CPDF_Point pt3(fWidth/2,0);\r
355 \r
356         FX_FLOAT px,py;\r
357 \r
358         csAP << cos(fRotate) << " " << sin(fRotate) << " " << -sin(fRotate) << " " << cos(fRotate) << " " \r
359                 << crBBox.left + fWidth / 2 << " " << crBBox.bottom + fHeight / 2 << " cm\n";\r
360 \r
361 \r
362         csAP << pt1.x << " " << pt1.y << " m\n";\r
363 \r
364         px = pt2.x - pt1.x;\r
365         py = pt2.y - pt1.y;\r
366 \r
367         csAP << pt1.x << " " << pt1.y + py * PWL_BEZIER << " " \r
368                 << pt2.x - px * PWL_BEZIER << " " << pt2.y << " "\r
369                 << pt2.x << " " << pt2.y << " c\n";\r
370 \r
371         px = pt3.x - pt2.x;\r
372         py = pt2.y - pt3.y;\r
373 \r
374         csAP << pt2.x + px * PWL_BEZIER << " " << pt2.y << " " \r
375                 << pt3.x << " " << pt3.y + py * PWL_BEZIER << " "\r
376                 << pt3.x << " " << pt3.y << " c\n";\r
377 \r
378         return csAP.GetByteString();\r
379 }\r
380 \r
381 \r
382 CPDF_Rect CPWL_Utils::InflateRect(const CPDF_Rect & rcRect, FX_FLOAT fSize)\r
383 {\r
384         if (rcRect.IsEmpty()) return rcRect;\r
385 \r
386         CPDF_Rect rcNew(rcRect.left - fSize,\r
387                                         rcRect.bottom - fSize,\r
388                                         rcRect.right + fSize,\r
389                                         rcRect.top + fSize);\r
390         rcNew.Normalize();\r
391         return rcNew;\r
392 }\r
393 \r
394 CPDF_Rect CPWL_Utils::DeflateRect(const CPDF_Rect & rcRect, FX_FLOAT fSize)\r
395 {\r
396         if (rcRect.IsEmpty()) return rcRect;\r
397 \r
398         CPDF_Rect rcNew(rcRect.left + fSize,\r
399                                         rcRect.bottom + fSize,\r
400                                         rcRect.right - fSize,\r
401                                         rcRect.top - fSize);\r
402         rcNew.Normalize();\r
403         return rcNew;\r
404 }\r
405 \r
406 CPDF_Rect CPWL_Utils::ScaleRect(const CPDF_Rect & rcRect,FX_FLOAT fScale)\r
407 {\r
408         FX_FLOAT fHalfWidth = (rcRect.right - rcRect.left) / 2.0f;\r
409         FX_FLOAT fHalfHeight = (rcRect.top - rcRect.bottom) / 2.0f;\r
410 \r
411         CPDF_Point ptCenter = CPDF_Point((rcRect.left + rcRect.right) / 2,(rcRect.top + rcRect.bottom) / 2);\r
412 \r
413         return CPDF_Rect(ptCenter.x - fHalfWidth * fScale,\r
414                                 ptCenter.y - fHalfHeight * fScale,\r
415                                 ptCenter.x + fHalfWidth * fScale,\r
416                                 ptCenter.y + fHalfHeight * fScale);\r
417 }\r
418 \r
419 CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color)\r
420 {\r
421         CFX_ByteTextBuf sAppStream;\r
422 \r
423         CFX_ByteString sColor = GetColorAppStream(color,TRUE);\r
424         if (sColor.GetLength() > 0)\r
425         {\r
426                 sAppStream << "q\n" << sColor;\r
427                 sAppStream << rect.left << " " << rect.bottom << " "\r
428                         << rect.right - rect.left << " " << rect.top - rect.bottom << " re f\nQ\n";             \r
429         }\r
430         \r
431         return sAppStream.GetByteString();\r
432 }\r
433 \r
434 CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color)\r
435 {\r
436         CFX_ByteTextBuf sAppStream;\r
437 \r
438         CFX_ByteString sColor = GetColorAppStream(color,TRUE);\r
439         if (sColor.GetLength() > 0)\r
440         {\r
441                 sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n";            \r
442         }\r
443         \r
444         return sAppStream.GetByteString();\r
445 }\r
446 \r
447 CPDF_Rect CPWL_Utils::GetCenterSquare(const CPDF_Rect & rect)\r
448 {\r
449         FX_FLOAT fWidth = rect.right -  rect.left;\r
450         FX_FLOAT fHeight = rect.top - rect.bottom;\r
451 \r
452         FX_FLOAT fCenterX = (rect.left + rect.right)/2.0f;\r
453         FX_FLOAT fCenterY = (rect.top + rect.bottom)/2.0f;\r
454 \r
455         FX_FLOAT fRadius = (fWidth > fHeight) ? fHeight / 2 : fWidth / 2;\r
456 \r
457         return CPDF_Rect(fCenterX - fRadius,fCenterY - fRadius,fCenterX + fRadius,fCenterY + fRadius);\r
458 }\r
459 \r
460 CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange, \r
461                                                                                                                 FX_BOOL bContinuous, FX_WORD SubWord)\r
462 {\r
463         return IFX_Edit::GetEditAppearanceStream(pEdit,ptOffset,pRange,bContinuous,SubWord);\r
464 }\r
465 \r
466 CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, \r
467                                                                 const CPVT_WordRange * pRange)\r
468 {\r
469         return IFX_Edit::GetSelectAppearanceStream(pEdit,ptOffset,pRange);\r
470 }\r
471 \r
472 static CFX_ByteString GetSquigglyAppearanceStream(FX_FLOAT fStartX, FX_FLOAT fEndX, FX_FLOAT fY, FX_FLOAT fStep)\r
473 {\r
474         CFX_ByteTextBuf sRet;\r
475 \r
476         sRet << "0 w\n" << fStartX << " " << fY << " m\n";\r
477 \r
478         FX_FLOAT fx;\r
479         FX_INT32 i;\r
480 \r
481         for (i=1,fx=fStartX+fStep; fx<fEndX; fx+=fStep,i++)\r
482         {\r
483                 sRet << fx << " " << fY + (i&1)*fStep << " l\n";\r
484         }\r
485 \r
486         sRet << "S\n";\r
487 \r
488         return sRet.GetByteString();\r
489 }\r
490 \r
491 static CFX_ByteString GetWordSpellCheckAppearanceStream(IFX_Edit_Iterator* pIterator, const CPDF_Point & ptOffset,\r
492                                                                                                                                   const CPVT_WordRange & wrWord)\r
493 {\r
494         CFX_ByteTextBuf sRet;\r
495 \r
496         FX_FLOAT fStartX = 0.0f;\r
497         FX_FLOAT fEndX = 0.0f;\r
498         FX_FLOAT fY = 0.0f;\r
499         FX_FLOAT fStep = 0.0f; \r
500 \r
501         FX_BOOL bBreak = FALSE;\r
502 \r
503         if (pIterator)\r
504         {\r
505                 pIterator->SetAt(wrWord.BeginPos);\r
506 \r
507                 do\r
508                 {\r
509                         CPVT_WordPlace place = pIterator->GetAt();\r
510 \r
511                         CPVT_Line line;                         \r
512                         if (pIterator->GetLine(line))\r
513                         {\r
514                                 fY = line.ptLine.y;\r
515                                 fStep = (line.fLineAscent - line.fLineDescent) / 16.0f;\r
516                         }\r
517 \r
518                         if (place.LineCmp(wrWord.BeginPos) == 0)\r
519                         {\r
520                                 pIterator->SetAt(wrWord.BeginPos);\r
521                                 CPVT_Word word;\r
522                                 if (pIterator->GetWord(word))\r
523                                 {\r
524                                         fStartX = word.ptWord.x;\r
525                                 }\r
526                         }\r
527                         else\r
528                         {\r
529                                 fStartX = line.ptLine.x;\r
530                         }\r
531 \r
532                         if (place.LineCmp(wrWord.EndPos) == 0)\r
533                         {\r
534                                 pIterator->SetAt(wrWord.EndPos);\r
535                                 CPVT_Word word;\r
536                                 if (pIterator->GetWord(word))\r
537                                 {\r
538                                         fEndX = word.ptWord.x + word.fWidth;\r
539                                 }\r
540 \r
541                                 bBreak = TRUE;\r
542                         }\r
543                         else\r
544                         {\r
545                                 fEndX = line.ptLine.x + line.fLineWidth;\r
546                         }\r
547 \r
548                         sRet << GetSquigglyAppearanceStream(fStartX + ptOffset.x, fEndX + ptOffset.x, fY + ptOffset.y,fStep);\r
549 \r
550                         if (bBreak) break;\r
551                 }\r
552                 while (pIterator->NextLine());\r
553         }\r
554 \r
555         return sRet.GetByteString();\r
556 }\r
557 \r
558 CFX_ByteString CPWL_Utils::GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellCheck* pSpellCheck, const CPDF_Point & ptOffset,\r
559                                                                 const CPVT_WordRange * pRange)\r
560 {\r
561         ASSERT(pEdit != NULL);\r
562         ASSERT(pSpellCheck != NULL);\r
563 \r
564         CFX_ByteTextBuf sRet;\r
565 \r
566         if (pRange && pRange->IsExist())\r
567         {\r
568                 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator())\r
569                 {\r
570                         pIterator->SetAt(pRange->BeginPos);\r
571 \r
572                         FX_BOOL bLatinWord = FALSE;\r
573                         CPVT_WordPlace wpWordStart;\r
574                         CFX_ByteString sWord;\r
575 \r
576                         CPVT_WordPlace oldplace;\r
577                         while (pIterator->NextWord())\r
578                         {\r
579                                 CPVT_WordPlace place = pIterator->GetAt();\r
580                                 if (pRange && place.WordCmp(pRange->EndPos) > 0) break;                         \r
581 \r
582                                 CPVT_Word word;\r
583                                 if (pIterator->GetWord(word))\r
584                                 {\r
585                                         if (FX_EDIT_ISLATINWORD(word.Word))\r
586                                         {\r
587                                                 if (!bLatinWord)\r
588                                                 {\r
589                                                         wpWordStart = place;\r
590                                                         bLatinWord = TRUE;                                                              \r
591                                                 }\r
592 \r
593                                                 sWord += (char)word.Word;\r
594                                                 oldplace = place;\r
595                                         }\r
596                                         else\r
597                                         {\r
598                                                 if (bLatinWord)\r
599                                                 {\r
600                                                         if (!pSpellCheck->CheckWord(sWord))\r
601                                                         {\r
602                                                                 sRet << GetWordSpellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace));\r
603                                                                 pIterator->SetAt(place);\r
604                                                         }\r
605                                                         bLatinWord = FALSE;\r
606                                                 }\r
607 \r
608                                                 sWord.Empty();\r
609                                         }\r
610                                 }\r
611                                 else\r
612                                 {\r
613                                         if (bLatinWord)\r
614                                         {\r
615                                                 if (!pSpellCheck->CheckWord(sWord))\r
616                                                         sRet << GetWordSpellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace));\r
617                                                 bLatinWord = FALSE;\r
618                                                 sWord.Empty();\r
619                                         }\r
620                                 }\r
621                         }\r
622 \r
623                         if (bLatinWord)\r
624                         {\r
625                                 if (!pSpellCheck->CheckWord(sWord))\r
626                                         sRet << GetWordSpellCheckAppearanceStream(pIterator,ptOffset,CPVT_WordRange(wpWordStart,oldplace));\r
627 \r
628                                 bLatinWord = FALSE;\r
629                                 sWord.Empty();\r
630                         }\r
631                 }\r
632         }\r
633 \r
634         return sRet.GetByteString();\r
635 }\r
636 \r
637 CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap,\r
638                                                                                                                 const CFX_WideString & sText, FX_INT32 nAlignmentH, FX_INT32 nAlignmentV,\r
639                                                                                                                 FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText)\r
640 {\r
641         CFX_ByteTextBuf sRet;\r
642 \r
643         if (IFX_Edit * pEdit = IFX_Edit::NewEdit())\r
644         {                       \r
645                 pEdit->SetFontMap(pFontMap);\r
646 \r
647                 pEdit->SetPlateRect(rcBBox);\r
648                 pEdit->SetAlignmentH(nAlignmentH);\r
649                 pEdit->SetAlignmentV(nAlignmentV);\r
650                 pEdit->SetMultiLine(bMultiLine);\r
651                 pEdit->SetAutoReturn(bAutoReturn);\r
652                 if (IsFloatZero(fFontSize))\r
653                         pEdit->SetAutoFontSize(TRUE);\r
654                 else\r
655                         pEdit->SetFontSize(fFontSize);\r
656                 pEdit->Initialize();\r
657 \r
658                 pEdit->SetText(sText);\r
659                 \r
660                 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f,0.0f));\r
661                 if (sEdit.GetLength() > 0)\r
662                 {\r
663                         sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";\r
664                 }\r
665                 \r
666                 IFX_Edit::DelEdit(pEdit);\r
667         }\r
668 \r
669         return sRet.GetByteString();\r
670 }\r
671 \r
672 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,\r
673                                                                                         IFX_Edit_FontMap * pFontMap,\r
674                                                                                         CPDF_Stream * pIconStream,\r
675                                                                                         CPDF_IconFit & IconFit,\r
676                                                                                         const CFX_WideString & sLabel,                                                                                  \r
677                                                                                         const CPWL_Color & crText,\r
678                                                                                         FX_FLOAT fFontSize,\r
679                                                                                         FX_INT32 nLayOut)\r
680 {\r
681         const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;    \r
682 \r
683         if (IFX_Edit * pEdit = IFX_Edit::NewEdit())\r
684         {                       \r
685                 pEdit->SetFontMap(pFontMap);\r
686 \r
687                 pEdit->SetAlignmentH(1);\r
688                 pEdit->SetAlignmentV(1);\r
689                 pEdit->SetMultiLine(FALSE);\r
690                 pEdit->SetAutoReturn(FALSE);\r
691                 if (IsFloatZero(fFontSize))\r
692                         pEdit->SetAutoFontSize(TRUE);\r
693                 else\r
694                         pEdit->SetFontSize(fFontSize);\r
695                 pEdit->Initialize();\r
696                 pEdit->SetText(sLabel);\r
697 \r
698                 CPDF_Rect rcLabelContent = pEdit->GetContentRect();\r
699                 \r
700                 CPWL_Icon Icon;\r
701                 PWL_CREATEPARAM cp;\r
702                 cp.dwFlags = PWS_VISIBLE;\r
703                 Icon.Create(cp);\r
704                 Icon.SetIconFit(&IconFit);\r
705                 Icon.SetPDFStream(pIconStream);\r
706 \r
707                 CPDF_Rect rcLabel = CPDF_Rect(0,0,0,0);\r
708                 CPDF_Rect rcIcon = CPDF_Rect(0,0,0,0);\r
709                 FX_FLOAT fWidth = 0.0f;\r
710                 FX_FLOAT fHeight = 0.0f;\r
711 \r
712                 switch (nLayOut)\r
713                 {\r
714                 case PPBL_LABEL:\r
715                         rcLabel = rcBBox;\r
716                         rcIcon = CPDF_Rect(0,0,0,0);\r
717                         break;\r
718                 case PPBL_ICON:\r
719                         rcIcon = rcBBox;\r
720                         rcLabel = CPDF_Rect(0,0,0,0);\r
721                         break;\r
722                 case PPBL_ICONTOPLABELBOTTOM:\r
723 \r
724                         if (pIconStream)\r
725                         {\r
726                                 if (IsFloatZero(fFontSize))\r
727                                 {\r
728                                         fHeight = rcBBox.top - rcBBox.bottom;\r
729                                         rcLabel = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.right,rcBBox.bottom + fHeight * fAutoFontScale);\r
730                                         rcIcon = CPDF_Rect(rcBBox.left,rcLabel.top,rcBBox.right,rcBBox.top);\r
731                                 }\r
732                                 else\r
733                                 {\r
734                                         fHeight = rcLabelContent.Height();\r
735 \r
736                                         if (rcBBox.bottom + fHeight > rcBBox.top)\r
737                                         {                       \r
738                                                 rcIcon = CPDF_Rect(0,0,0,0);                            \r
739                                                 rcLabel = rcBBox;\r
740                                         }\r
741                                         else\r
742                                         {\r
743                                                 rcLabel = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.right,rcBBox.bottom + fHeight);\r
744                                                 rcIcon = CPDF_Rect(rcBBox.left,rcLabel.top,rcBBox.right,rcBBox.top);    \r
745                                         }\r
746                                 }\r
747                         }\r
748                         else\r
749                         {\r
750                                 rcLabel = rcBBox;\r
751                                 rcIcon = CPDF_Rect(0,0,0,0);\r
752                         }\r
753 \r
754                         break;\r
755                 case PPBL_LABELTOPICONBOTTOM:\r
756 \r
757                         if (pIconStream)\r
758                         {\r
759                                 if (IsFloatZero(fFontSize))\r
760                                 {\r
761                                         fHeight = rcBBox.top - rcBBox.bottom;\r
762                                         rcLabel = CPDF_Rect(rcBBox.left,rcBBox.top - fHeight * fAutoFontScale ,rcBBox.right,rcBBox.top);\r
763                                         rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.right,rcLabel.bottom);\r
764                                 }\r
765                                 else\r
766                                 {\r
767                                         fHeight = rcLabelContent.Height();\r
768 \r
769                                         if (rcBBox.bottom + fHeight > rcBBox.top)\r
770                                         {                       \r
771                                                 rcIcon = CPDF_Rect(0,0,0,0);                            \r
772                                                 rcLabel = rcBBox;\r
773                                         }\r
774                                         else\r
775                                         {\r
776                                                 rcLabel = CPDF_Rect(rcBBox.left,rcBBox.top - fHeight,rcBBox.right,rcBBox.top);\r
777                                                 rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.right,rcLabel.bottom);              \r
778                                         }\r
779                                 }\r
780                         }\r
781                         else\r
782                         {\r
783                                 rcLabel = rcBBox;\r
784                                 rcIcon = CPDF_Rect(0,0,0,0);\r
785                         }\r
786 \r
787                         break;\r
788                 case PPBL_ICONLEFTLABELRIGHT:\r
789 \r
790                         if (pIconStream)\r
791                         {\r
792                                 if (IsFloatZero(fFontSize))\r
793                                 {\r
794                                         fWidth = rcBBox.right - rcBBox.left;\r
795                                         rcLabel = CPDF_Rect(rcBBox.right - fWidth * fAutoFontScale,rcBBox.bottom,rcBBox.right,rcBBox.top);\r
796                                         rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcLabel.left,rcBBox.top);\r
797 \r
798                                         if (rcLabelContent.Width() < fWidth * fAutoFontScale)\r
799                                         {                                                       \r
800                                         }\r
801                                         else \r
802                                         {\r
803                                                 if (rcLabelContent.Width() < fWidth)\r
804                                                 {\r
805                                                         rcLabel = CPDF_Rect(rcBBox.right - rcLabelContent.Width(),rcBBox.bottom,rcBBox.right,rcBBox.top);\r
806                                                         rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcLabel.left,rcBBox.top);\r
807                                                 }\r
808                                                 else\r
809                                                 {\r
810                                                         rcLabel = rcBBox;\r
811                                                         rcIcon = CPDF_Rect(0,0,0,0);\r
812                                                 }\r
813                                         }\r
814                                 }\r
815                                 else\r
816                                 {\r
817                                         fWidth = rcLabelContent.Width();\r
818 \r
819                                         if (rcBBox.left + fWidth > rcBBox.right)\r
820                                         {\r
821                                                 rcLabel = rcBBox;\r
822                                                 rcIcon = CPDF_Rect(0,0,0,0);\r
823                                         }\r
824                                         else\r
825                                         {\r
826                                                 rcLabel = CPDF_Rect(rcBBox.right - fWidth,rcBBox.bottom,rcBBox.right,rcBBox.top);\r
827                                                 rcIcon = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcLabel.left,rcBBox.top);                  \r
828                                         }\r
829                                 }\r
830                         }\r
831                         else\r
832                         {\r
833                                 rcLabel = rcBBox;\r
834                                 rcIcon = CPDF_Rect(0,0,0,0);\r
835                         }\r
836 \r
837                         break;\r
838                 case PPBL_LABELLEFTICONRIGHT:\r
839 \r
840                         if (pIconStream)\r
841                         {\r
842                                 if (IsFloatZero(fFontSize))\r
843                                 {\r
844                                         fWidth = rcBBox.right - rcBBox.left;\r
845                                         rcLabel = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.left + fWidth * fAutoFontScale,rcBBox.top);\r
846                                         rcIcon = CPDF_Rect(rcLabel.right,rcBBox.bottom,rcBBox.right,rcBBox.top);\r
847 \r
848                                         if (rcLabelContent.Width() < fWidth * fAutoFontScale)\r
849                                         {                                                       \r
850                                         }\r
851                                         else \r
852                                         {\r
853                                                 if (rcLabelContent.Width() < fWidth)\r
854                                                 {\r
855                                                         rcLabel = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.left + rcLabelContent.Width(),rcBBox.top);\r
856                                                         rcIcon = CPDF_Rect(rcLabel.right,rcBBox.bottom,rcBBox.right,rcBBox.top);\r
857                                                 }\r
858                                                 else\r
859                                                 {\r
860                                                         rcLabel = rcBBox;\r
861                                                         rcIcon = CPDF_Rect(0,0,0,0);\r
862                                                 }\r
863                                         }\r
864                                 }\r
865                                 else\r
866                                 {\r
867                                         fWidth = rcLabelContent.Width();\r
868 \r
869                                         if (rcBBox.left + fWidth > rcBBox.right)\r
870                                         {\r
871                                                 rcLabel = rcBBox;\r
872                                                 rcIcon = CPDF_Rect(0,0,0,0);\r
873                                         }\r
874                                         else\r
875                                         {\r
876                                                 rcLabel = CPDF_Rect(rcBBox.left,rcBBox.bottom,rcBBox.left + fWidth,rcBBox.top);\r
877                                                 rcIcon = CPDF_Rect(rcLabel.right,rcBBox.bottom,rcBBox.right,rcBBox.top);                \r
878                                         }       \r
879                                 }\r
880                         }\r
881                         else\r
882                         {\r
883                                 rcLabel = rcBBox;\r
884                                 rcIcon = CPDF_Rect(0,0,0,0);\r
885                         }\r
886 \r
887                         break;\r
888                 case PPBL_LABELOVERICON:\r
889                         rcLabel = rcBBox;\r
890                         rcIcon = rcBBox;\r
891                         break;\r
892                 }\r
893 \r
894                 CFX_ByteTextBuf sAppStream,sTemp;\r
895 \r
896                 if (!rcIcon.IsEmpty())\r
897                 {\r
898                         Icon.Move(rcIcon, FALSE, FALSE);\r
899                         sTemp << Icon.GetImageAppStream();\r
900                 }\r
901 \r
902                 Icon.Destroy();\r
903 \r
904                 if (!rcLabel.IsEmpty())\r
905                 {\r
906                         pEdit->SetPlateRect(rcLabel);\r
907                         CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0.0f,0.0f));\r
908                         if (sEdit.GetLength() > 0)\r
909                         {\r
910                                 sTemp << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";\r
911                         }\r
912                 }\r
913 \r
914                 IFX_Edit::DelEdit(pEdit);\r
915 \r
916                 if (sTemp.GetSize() > 0)\r
917                 {\r
918                         sAppStream << "q\n" << rcBBox.left << " " << rcBBox.bottom << " "\r
919                                 << rcBBox.right - rcBBox.left << " " << rcBBox.top - rcBBox.bottom << " re W n\n";\r
920                         sAppStream << sTemp << "Q\n";\r
921                 }\r
922 \r
923                 return sAppStream.GetByteString();\r
924         }\r
925 \r
926         return "";\r
927 }\r
928 \r
929 CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color & color,const FX_BOOL & bFillOrStroke)\r
930 {\r
931         CFX_ByteTextBuf sColorStream;\r
932 \r
933         switch (color.nColorType)\r
934         {               \r
935         case COLORTYPE_RGB:\r
936                 sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " \r
937                         << (bFillOrStroke ? "rg" : "RG") << "\n";\r
938                 break;\r
939         case COLORTYPE_GRAY:\r
940                 sColorStream << color.fColor1 << " " << (bFillOrStroke ? "g" : "G") << "\n";\r
941                 break;\r
942         case COLORTYPE_CMYK:\r
943                 sColorStream << color.fColor1 << " " << color.fColor2 << " " << color.fColor3 << " " << color.fColor4 << " " \r
944                         << (bFillOrStroke ? "k" : "K") << "\n";\r
945                 break;\r
946         }\r
947 \r
948         return sColorStream.GetByteString();\r
949 }\r
950 \r
951 CFX_ByteString CPWL_Utils::GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,\r
952                                                                                                 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,\r
953                                                                                                 FX_INT32 nStyle, const CPWL_Dash & dash)\r
954 {\r
955         CFX_ByteTextBuf sAppStream;\r
956         CFX_ByteString sColor;\r
957 \r
958         FX_FLOAT fLeft = rect.left;\r
959         FX_FLOAT fRight = rect.right;\r
960         FX_FLOAT fTop = rect.top;\r
961         FX_FLOAT fBottom = rect.bottom;\r
962 \r
963         if (fWidth > 0.0f)\r
964         {\r
965                 FX_FLOAT fHalfWidth = fWidth / 2.0f;\r
966 \r
967                 sAppStream << "q\n";\r
968 \r
969                 switch (nStyle)\r
970                 {\r
971                 default:\r
972                 case PBS_SOLID:\r
973                         sColor = CPWL_Utils::GetColorAppStream(color,TRUE);\r
974                         if (sColor.GetLength() > 0)\r
975                         {\r
976                                 sAppStream << sColor;\r
977                                 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " << fTop - fBottom << " re\n";\r
978                                 sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " \r
979                                         << fRight - fLeft - fWidth * 2 << " " << fTop - fBottom - fWidth * 2 << " re\n";\r
980                                 sAppStream << "f*\n";\r
981                         }\r
982                         break;\r
983                 case PBS_DASH:\r
984                         sColor = CPWL_Utils::GetColorAppStream(color,FALSE);\r
985                         if (sColor.GetLength() > 0)\r
986                         {\r
987                                 sAppStream << sColor;\r
988                                 sAppStream << fWidth << " w" << " [" << dash.nDash << " " << dash.nGap << "] " << dash.nPhase << " d\n";\r
989                                 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 << " m\n";\r
990                                 sAppStream << fLeft + fWidth / 2 << " " << fTop - fWidth / 2 << " l\n";\r
991                                 sAppStream << fRight - fWidth / 2 << " " << fTop - fWidth / 2 << " l\n";\r
992                                 sAppStream << fRight - fWidth / 2 << " " << fBottom + fWidth / 2 << " l\n";\r
993                                 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 << " l S\n";\r
994                         }\r
995                         break;\r
996                 case PBS_BEVELED:\r
997                 case PBS_INSET:\r
998                         sColor = CPWL_Utils::GetColorAppStream(crLeftTop,TRUE);\r
999                         if (sColor.GetLength() > 0)\r
1000                         {\r
1001                                 sAppStream << sColor;\r
1002                                 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " m\n";\r
1003                                 sAppStream << fLeft + fHalfWidth << " " << fTop - fHalfWidth << " l\n";\r
1004                                 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth << " l\n";\r
1005                                 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 << " l\n";\r
1006                                 sAppStream << fLeft + fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 << " l\n";\r
1007                                 sAppStream << fLeft + fHalfWidth * 2 << " " << fBottom + fHalfWidth * 2 << " l f\n";\r
1008                         }\r
1009 \r
1010                         sColor = CPWL_Utils::GetColorAppStream(crRightBottom,TRUE);\r
1011                         if (sColor.GetLength() > 0)\r
1012                         {\r
1013                                 sAppStream << sColor;\r
1014                                 sAppStream << fRight - fHalfWidth << " " <<     fTop - fHalfWidth << " m\n";\r
1015                                 sAppStream << fRight - fHalfWidth << " " <<     fBottom + fHalfWidth << " l\n";\r
1016                                 sAppStream << fLeft + fHalfWidth << " " <<      fBottom + fHalfWidth << " l\n";\r
1017                                 sAppStream << fLeft + fHalfWidth * 2 << " " << fBottom + fHalfWidth * 2 << " l\n";\r
1018                                 sAppStream << fRight - fHalfWidth * 2 << " " << fBottom + fHalfWidth * 2 << " l\n";\r
1019                                 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 << " l f\n";\r
1020                         }\r
1021 \r
1022                         sColor = CPWL_Utils::GetColorAppStream(color,TRUE);\r
1023                         if (sColor.GetLength() > 0)\r
1024                         {\r
1025                                 sAppStream << sColor;\r
1026                                 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " << fTop - fBottom << " re\n";\r
1027                                 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " \r
1028                                         << fRight - fLeft - fHalfWidth * 2 << " " << fTop - fBottom - fHalfWidth * 2 << " re f*\n";                                             \r
1029                         }\r
1030                         break;\r
1031                 case PBS_UNDERLINED:\r
1032                         sColor = CPWL_Utils::GetColorAppStream(color,FALSE);\r
1033                         if (sColor.GetLength() > 0)\r
1034                         {\r
1035                                 sAppStream << sColor;\r
1036                                 sAppStream << fWidth << " w\n";\r
1037                                 sAppStream << fLeft << " " << fBottom + fWidth / 2 << " m\n";\r
1038                                 sAppStream << fRight << " " << fBottom + fWidth / 2 << " l S\n";\r
1039                         }\r
1040                         break;\r
1041                 }\r
1042                 \r
1043                 sAppStream << "Q\n";\r
1044         }\r
1045 \r
1046         return sAppStream.GetByteString();\r
1047 }\r
1048 \r
1049 CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,\r
1050                                                                                                 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,\r
1051                                                                                                 FX_INT32 nStyle, const CPWL_Dash & dash)\r
1052 {\r
1053         CFX_ByteTextBuf sAppStream;\r
1054         CFX_ByteString sColor;\r
1055 \r
1056         \r
1057 \r
1058 \r
1059 \r
1060 \r
1061         if (fWidth > 0.0f)\r
1062         {\r
1063                 sAppStream << "q\n";\r
1064 \r
1065                 switch (nStyle)\r
1066                 {\r
1067                 default:\r
1068                 case PBS_SOLID:\r
1069                 case PBS_UNDERLINED:\r
1070                         {\r
1071                                 sColor = CPWL_Utils::GetColorAppStream(color,FALSE);\r
1072                                 if (sColor.GetLength() > 0)\r
1073                                 {\r
1074                                         sAppStream << "q\n" << fWidth << " w\n" << sColor \r
1075                                                 << CPWL_Utils::GetAP_Circle(CPWL_Utils::DeflateRect(rect,fWidth / 2.0f))\r
1076                                                 << " S\nQ\n";\r
1077                                 }\r
1078                         }\r
1079                         break;\r
1080                 case PBS_DASH:\r
1081                         {\r
1082                                 sColor = CPWL_Utils::GetColorAppStream(color,FALSE);\r
1083                                 if (sColor.GetLength() > 0)\r
1084                                 {\r
1085                                         sAppStream << "q\n" << fWidth << " w\n" \r
1086                                                 << "[" << dash.nDash << " " << dash.nGap << "] " << dash.nPhase << " d\n" \r
1087                                                 << sColor << CPWL_Utils::GetAP_Circle(CPWL_Utils::DeflateRect(rect,fWidth / 2.0f))\r
1088                                                 << " S\nQ\n";\r
1089                                 }                                               \r
1090                         }\r
1091                         break;\r
1092                 case PBS_BEVELED:\r
1093                         {\r
1094                                 FX_FLOAT fHalfWidth = fWidth / 2.0f;\r
1095 \r
1096                                 sColor = CPWL_Utils::GetColorAppStream(color,FALSE);\r
1097                                 if (sColor.GetLength() > 0)\r
1098                                 {\r
1099                                         sAppStream << "q\n" << fHalfWidth << " w\n"\r
1100                                                 << sColor << CPWL_Utils::GetAP_Circle(rect)\r
1101                                                 << " S\nQ\n";\r
1102                                 }                                       \r
1103 \r
1104                                 sColor = CPWL_Utils::GetColorAppStream(crLeftTop,FALSE);\r
1105                                 if (sColor.GetLength() > 0)\r
1106                                 {\r
1107                                         sAppStream << "q\n" << fHalfWidth << " w\n"\r
1108                                                 << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f)\r
1109                                                 << " S\nQ\n";\r
1110                                 }       \r
1111 \r
1112                                 sColor = CPWL_Utils::GetColorAppStream(crRightBottom,FALSE);\r
1113                                 if (sColor.GetLength() > 0)\r
1114                                 {\r
1115                                         sAppStream << "q\n" << fHalfWidth << " w\n"\r
1116                                                 << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f)\r
1117                                                 << " S\nQ\n";\r
1118                                 }       \r
1119                         }\r
1120                         break;\r
1121                 case PBS_INSET:\r
1122                         {\r
1123                                 FX_FLOAT fHalfWidth = fWidth / 2.0f;\r
1124 \r
1125                                 sColor = CPWL_Utils::GetColorAppStream(color,FALSE);\r
1126                                 if (sColor.GetLength() > 0)\r
1127                                 {\r
1128                                         sAppStream << "q\n" << fHalfWidth << " w\n"\r
1129                                                 << sColor << CPWL_Utils::GetAP_Circle(rect)\r
1130                                                 << " S\nQ\n";\r
1131                                 }\r
1132 \r
1133                                 sColor = CPWL_Utils::GetColorAppStream(crLeftTop,FALSE);\r
1134                                 if (sColor.GetLength() > 0)\r
1135                                 {\r
1136                                         sAppStream << "q\n" << fHalfWidth << " w\n"\r
1137                                                 << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI/4.0f)\r
1138                                                 << " S\nQ\n";\r
1139                                 }       \r
1140 \r
1141                                 sColor = CPWL_Utils::GetColorAppStream(crRightBottom,FALSE);\r
1142                                 if (sColor.GetLength() > 0)\r
1143                                 {\r
1144                                         sAppStream << "q\n" << fHalfWidth << " w\n"\r
1145                                                 << sColor << CPWL_Utils::GetAP_HalfCircle(CPWL_Utils::DeflateRect(rect,fHalfWidth * 0.75f),PWL_PI*5/4.0f)\r
1146                                                 << " S\nQ\n";\r
1147                                 }                                               \r
1148                         }\r
1149                         break;\r
1150                 }\r
1151                 \r
1152                 sAppStream << "Q\n";\r
1153         }\r
1154 \r
1155         return sAppStream.GetByteString();\r
1156 }\r
1157 \r
1158 CPWL_Color CPWL_Utils::SubstractColor(const CPWL_Color & sColor,FX_FLOAT fColorSub)\r
1159 {\r
1160         CPWL_Color sRet;\r
1161         sRet.nColorType = sColor.nColorType;\r
1162 \r
1163         switch (sColor.nColorType)\r
1164         {\r
1165         case COLORTYPE_TRANSPARENT:\r
1166                 sRet.nColorType = COLORTYPE_RGB;\r
1167                 sRet.fColor1 = PWL_MAX(1 - fColorSub,0.0f);\r
1168                 sRet.fColor2 = PWL_MAX(1 - fColorSub,0.0f);\r
1169                 sRet.fColor3 = PWL_MAX(1 - fColorSub,0.0f);\r
1170                 break;\r
1171         case COLORTYPE_RGB:\r
1172         case COLORTYPE_GRAY:\r
1173         case COLORTYPE_CMYK:\r
1174                 sRet.fColor1 = PWL_MAX(sColor.fColor1 - fColorSub,0.0f);\r
1175                 sRet.fColor2 = PWL_MAX(sColor.fColor2 - fColorSub,0.0f);\r
1176                 sRet.fColor3 = PWL_MAX(sColor.fColor3 - fColorSub,0.0f);\r
1177                 sRet.fColor4 = PWL_MAX(sColor.fColor4 - fColorSub,0.0f);\r
1178                 break;\r
1179         }       \r
1180 \r
1181         return sRet;\r
1182 }\r
1183 \r
1184 CPWL_Color CPWL_Utils::DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevide)\r
1185 {\r
1186         CPWL_Color sRet;\r
1187         sRet.nColorType = sColor.nColorType;\r
1188 \r
1189         switch (sColor.nColorType)\r
1190         {\r
1191         case COLORTYPE_TRANSPARENT:\r
1192                 sRet.nColorType = COLORTYPE_RGB;\r
1193                 sRet.fColor1 = 1 / fColorDevide;\r
1194                 sRet.fColor2 = 1 / fColorDevide;\r
1195                 sRet.fColor3 = 1 / fColorDevide;\r
1196                 break;\r
1197         case COLORTYPE_RGB:\r
1198         case COLORTYPE_GRAY:\r
1199         case COLORTYPE_CMYK:\r
1200                 sRet = sColor;\r
1201                 sRet.fColor1 /= fColorDevide;\r
1202                 sRet.fColor2 /= fColorDevide;\r
1203                 sRet.fColor3 /= fColorDevide;\r
1204                 sRet.fColor4 /= fColorDevide;\r
1205                 break;\r
1206         }       \r
1207 \r
1208         return sRet;\r
1209 }\r
1210 \r
1211 CFX_ByteString CPWL_Utils::GetAppStream_Check(const CPDF_Rect & rcBBox, const CPWL_Color & crText)\r
1212 {\r
1213         CFX_ByteTextBuf sAP;\r
1214         sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n";\r
1215         return sAP.GetByteString();\r
1216 }\r
1217 \r
1218 CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText)\r
1219 {\r
1220         CFX_ByteTextBuf sAP;\r
1221         sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n";\r
1222         return sAP.GetByteString();\r
1223 }\r
1224 \r
1225 CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CPDF_Rect & rcBBox, const CPWL_Color & crText)\r
1226 {\r
1227         CFX_ByteTextBuf sAP;\r
1228         sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,FALSE) << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n";\r
1229         return sAP.GetByteString();\r
1230 }\r
1231 \r
1232 CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CPDF_Rect & rcBBox, const CPWL_Color & crText)\r
1233 {\r
1234         CFX_ByteTextBuf sAP;\r
1235         sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n";\r
1236         return sAP.GetByteString();\r
1237 }\r
1238 \r
1239 CFX_ByteString CPWL_Utils::GetAppStream_Square(const CPDF_Rect & rcBBox, const CPWL_Color & crText)\r
1240 {\r
1241         CFX_ByteTextBuf sAP;\r
1242         sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n";\r
1243         return sAP.GetByteString();\r
1244 }\r
1245 \r
1246 CFX_ByteString CPWL_Utils::GetAppStream_Star(const CPDF_Rect & rcBBox, const CPWL_Color & crText)\r
1247 {\r
1248         CFX_ByteTextBuf sAP;\r
1249         sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText,TRUE) << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n";\r
1250         return sAP.GetByteString();\r
1251 }\r
1252 \r
1253 CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CPDF_Rect & rcBBox,\r
1254                                                                                                         FX_INT32 nStyle,\r
1255                                                                                                         const CPWL_Color & crText)\r
1256 {\r
1257         CPDF_Rect rcCenter = GetCenterSquare(rcBBox);\r
1258         switch (nStyle)\r
1259         {\r
1260         default:\r
1261         case PCS_CHECK:\r
1262                 return GetAppStream_Check(rcCenter,crText);\r
1263         case PCS_CIRCLE:\r
1264                 return GetAppStream_Circle(ScaleRect(rcCenter,2.0f/3.0f),crText);\r
1265         case PCS_CROSS:\r
1266                 return GetAppStream_Cross(rcCenter,crText);\r
1267         case PCS_DIAMOND:\r
1268                 return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText);              \r
1269         case PCS_SQUARE:\r
1270                 return GetAppStream_Square(ScaleRect(rcCenter,2.0f/3.0f),crText);\r
1271         case PCS_STAR:\r
1272                 return GetAppStream_Star(ScaleRect(rcCenter,2.0f/3.0f),crText);\r
1273         }\r
1274 }\r
1275 \r
1276 CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CPDF_Rect & rcBBox,\r
1277                                                                                                         FX_INT32 nStyle,\r
1278                                                                                                         const CPWL_Color & crText)\r
1279 {\r
1280         CPDF_Rect rcCenter = GetCenterSquare(rcBBox);\r
1281         switch (nStyle)\r
1282         {\r
1283         default:\r
1284         case PCS_CHECK:\r
1285                 return GetAppStream_Check(rcCenter,crText);\r
1286         case PCS_CIRCLE:\r
1287                 return GetAppStream_Circle(ScaleRect(rcCenter,1.0f/2.0f),crText);\r
1288         case PCS_CROSS:\r
1289                 return GetAppStream_Cross(rcCenter,crText);\r
1290         case PCS_DIAMOND:\r
1291                 return GetAppStream_Diamond(ScaleRect(rcCenter,2.0f/3.0f),crText);              \r
1292         case PCS_SQUARE:\r
1293                 return GetAppStream_Square(ScaleRect(rcCenter,2.0f/3.0f),crText);\r
1294         case PCS_STAR:\r
1295                 return GetAppStream_Star(ScaleRect(rcCenter,2.0f/3.0f),crText);\r
1296         }\r
1297 }\r
1298 \r
1299 CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CPDF_Rect & rcBBox)\r
1300 {\r
1301         CFX_ByteTextBuf sAppStream;\r
1302 \r
1303         if (!rcBBox.IsEmpty())\r
1304         {\r
1305                 sAppStream << "q\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f),TRUE);\r
1306                 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " \r
1307                                 << rcBBox.right - rcBBox.left << " " << rcBBox.top - rcBBox.bottom << " re f\n";\r
1308                 sAppStream << "Q\n";\r
1309 \r
1310                 sAppStream << "q\n" << \r
1311                         CPWL_Utils::GetBorderAppStream(rcBBox,2,CPWL_Color(COLORTYPE_GRAY,0),CPWL_Color(COLORTYPE_GRAY,1),CPWL_Color(COLORTYPE_GRAY,0.5),PBS_BEVELED,CPWL_Dash(3,0,0)) \r
1312                         << "Q\n";\r
1313 \r
1314                 CPDF_Point ptCenter = CPDF_Point((rcBBox.left + rcBBox.right)/2,(rcBBox.top + rcBBox.bottom)/2);\r
1315                 if (IsFloatBigger(rcBBox.right - rcBBox.left,6) && IsFloatBigger(rcBBox.top - rcBBox.bottom,6))\r
1316                 {\r
1317                         sAppStream << "q\n" << " 0 g\n";\r
1318                         sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " m\n";\r
1319                         sAppStream << ptCenter.x + 3 << " " << ptCenter.y + 1.5f << " l\n";\r
1320                         sAppStream << ptCenter.x << " " << ptCenter.y - 1.5f << " l\n";\r
1321                         sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " l f\n";\r
1322                         sAppStream << "Q\n";\r
1323                 }\r
1324         }\r
1325 \r
1326         return sAppStream.GetByteString();\r
1327 }\r
1328 \r
1329 void CPWL_Utils::ConvertCMYK2GRAY(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dGray)\r
1330 {\r
1331         if (dC<0 || dC>1 || dM<0 || dM>1 || dY < 0 || dY >1 || dK < 0 || dK >1)\r
1332                 return;\r
1333         dGray = 1.0f - FX_MIN(1.0f,0.3f*dC+0.59f * dM + 0.11f*dY+dK);\r
1334 }\r
1335 \r
1336 void CPWL_Utils::ConvertGRAY2CMYK(FX_FLOAT dGray,FX_FLOAT  &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK)\r
1337 {\r
1338         if (dGray <0 || dGray >1)\r
1339                 return;\r
1340         dC = 0.0f;\r
1341         dM = 0.0f;\r
1342         dY = 0.0f;\r
1343         dK = 1.0f-dGray;\r
1344 }\r
1345 \r
1346 void CPWL_Utils::ConvertGRAY2RGB(FX_FLOAT dGray,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB)\r
1347 {\r
1348         if (dGray <0 || dGray >1)\r
1349                 return;\r
1350         dR = dGray;\r
1351         dG = dGray;\r
1352         dB = dGray;\r
1353 }\r
1354 \r
1355 void CPWL_Utils::ConvertRGB2GRAY(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dGray)\r
1356 {\r
1357         if (dR<0 || dR>1 || dG<0 || dG > 0 || dB < 0 || dB >1)\r
1358                 return;\r
1359         dGray = 0.3f*dR+0.59f*dG+0.11f*dB;\r
1360 }\r
1361 \r
1362 void CPWL_Utils::ConvertCMYK2RGB(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB)\r
1363 {\r
1364         if (dC <0 || dC>1 || dM < 0 || dM > 1 || dY < 0 || dY > 1 || dK < 0 || dK > 1 )\r
1365                 return;\r
1366         dR = 1.0f - FX_MIN(1.0f, dC + dK);\r
1367         dG = 1.0f - FX_MIN(1.0f, dM + dK);\r
1368         dB = 1.0f - FX_MIN(1.0f, dY + dK);\r
1369 }\r
1370 \r
1371 void CPWL_Utils::ConvertRGB2CMYK(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK)\r
1372 {\r
1373         if (dR<0 || dR>1 || dG<0 || dG>1 || dB<0 || dB>1)\r
1374                 return;\r
1375 \r
1376         dC = 1.0f - dR;\r
1377         dM = 1.0f - dG;\r
1378         dY = 1.0f - dB;\r
1379         dK = FX_MIN(dC, FX_MIN(dM, dY));\r
1380 }\r
1381 \r
1382 void CPWL_Utils::PWLColorToARGB(const CPWL_Color& color, FX_INT32& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue)\r
1383 {\r
1384         switch (color.nColorType)\r
1385         {\r
1386         case COLORTYPE_TRANSPARENT:\r
1387                 {\r
1388                         alpha = 0;\r
1389                 }\r
1390                 break;\r
1391         case COLORTYPE_GRAY:\r
1392                 {\r
1393                         ConvertGRAY2RGB(color.fColor1, red, green, blue);\r
1394                 }\r
1395                 break;\r
1396         case COLORTYPE_RGB:\r
1397                 {\r
1398                         red = color.fColor1;\r
1399                         green = color.fColor2;\r
1400                         blue = color.fColor3;\r
1401                 }\r
1402                 break;\r
1403         case COLORTYPE_CMYK:\r
1404                 {\r
1405                         ConvertCMYK2RGB(color.fColor1, color.fColor2, color.fColor3, color.fColor4,\r
1406                                 red, green, blue);\r
1407                 }\r
1408                 break;\r
1409         }\r
1410 }\r
1411 \r
1412 FX_COLORREF CPWL_Utils::PWLColorToFXColor(const CPWL_Color& color, FX_INT32 nTransparancy)\r
1413 {\r
1414         FX_INT32 nAlpha = nTransparancy;\r
1415         FX_FLOAT dRed = 0;\r
1416         FX_FLOAT dGreen = 0;\r
1417         FX_FLOAT dBlue = 0;\r
1418 \r
1419         PWLColorToARGB(color, nAlpha, dRed, dGreen, dBlue);\r
1420 \r
1421         return ArgbEncode(nAlpha, (FX_INT32)(dRed*255), (FX_INT32)(dGreen*255), (FX_INT32)(dBlue*255));\r
1422 }\r
1423 \r
1424 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,\r
1425                                                           const FX_COLORREF & color)\r
1426 {\r
1427         CFX_PathData path;\r
1428         CPDF_Rect rcTemp(rect); \r
1429         path.AppendRect(rcTemp.left,rcTemp.bottom,rcTemp.right,rcTemp.top);\r
1430         pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING);\r
1431 }\r
1432 \r
1433 void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,\r
1434                                                         const CPDF_Point* pPts, FX_INT32 nCount, const FX_COLORREF& color)\r
1435 {\r
1436         CFX_PathData path;\r
1437         path.SetPointCount(nCount);\r
1438 \r
1439         path.SetPoint(0, pPts[0].x, pPts[0].y, FXPT_MOVETO);\r
1440         for (FX_INT32 i=1; i<nCount; i++)\r
1441                 path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO);\r
1442 \r
1443         pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE);\r
1444 }\r
1445 \r
1446 void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,\r
1447                                                           const FX_COLORREF & color, FX_FLOAT fWidth)\r
1448 {\r
1449         CFX_PathData path;\r
1450         CPDF_Rect rcTemp(rect); \r
1451         path.AppendRect(rcTemp.left,rcTemp.bottom,rcTemp.right,rcTemp.top);\r
1452         \r
1453         CFX_GraphStateData gsd;\r
1454         gsd.m_LineWidth = fWidth;\r
1455 \r
1456         pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE);\r
1457 }\r
1458 \r
1459 void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,\r
1460                                                         const CPDF_Point & ptMoveTo, const CPDF_Point & ptLineTo, const FX_COLORREF & color, FX_FLOAT fWidth)\r
1461 {\r
1462         CFX_PathData path;\r
1463         path.SetPointCount(2);\r
1464         path.SetPoint(0, ptMoveTo.x, ptMoveTo.y, FXPT_MOVETO);\r
1465         path.SetPoint(1, ptLineTo.x, ptLineTo.y, FXPT_LINETO);\r
1466 \r
1467         CFX_GraphStateData gsd;\r
1468         gsd.m_LineWidth = fWidth;\r
1469 \r
1470         pDevice->DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE);\r
1471 }\r
1472 \r
1473 void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,\r
1474                                                           const CPWL_Color & color, FX_INT32 nTransparancy)\r
1475 {\r
1476         CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rect,PWLColorToFXColor(color,nTransparancy));\r
1477 }\r
1478 \r
1479 void CPWL_Utils::DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,\r
1480                                                                                                                 FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect,\r
1481                                                                                                                 FX_INT32 nTransparancy, FX_INT32 nStartGray, FX_INT32 nEndGray)\r
1482 {\r
1483         FX_FLOAT fStepGray = 1.0f;\r
1484 \r
1485         if (bVertical)\r
1486         {\r
1487                 fStepGray = (nEndGray - nStartGray) / rect.Height();\r
1488 \r
1489                 for (FX_FLOAT fy=rect.bottom+0.5f; fy<=rect.top-0.5f; fy+=1.0f)\r
1490                 {                       \r
1491                         FX_INT32 nGray = nStartGray + (FX_INT32)(fStepGray * (fy-rect.bottom));\r
1492                         CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_Point(rect.left, fy),\r
1493                                 CPDF_Point(rect.right, fy), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f);\r
1494                 }\r
1495         }\r
1496 \r
1497         if (bHorizontal)\r
1498         {\r
1499                 fStepGray = (nEndGray - nStartGray) / rect.Width();\r
1500 \r
1501                 for (FX_FLOAT fx=rect.left+0.5f; fx<=rect.right-0.5f; fx+=1.0f)\r
1502                 {                       \r
1503                         FX_INT32 nGray = nStartGray + (FX_INT32)(fStepGray * (fx-rect.left));\r
1504                         CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, CPDF_Point(fx, rect.bottom),\r
1505                                 CPDF_Point(fx, rect.top), ArgbEncode(nTransparancy, nGray, nGray, nGray), 1.5f);\r
1506                 }\r
1507         }\r
1508 }\r
1509 \r
1510 void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,\r
1511                                                                                                 const CPDF_Rect & rect, FX_FLOAT fWidth,\r
1512                                                                                                 const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,\r
1513                                                                                                 FX_INT32 nStyle, const CPWL_Dash & dash, FX_INT32 nTransparancy)\r
1514 {\r
1515         FX_FLOAT fLeft = rect.left;\r
1516         FX_FLOAT fRight = rect.right;\r
1517         FX_FLOAT fTop = rect.top;\r
1518         FX_FLOAT fBottom = rect.bottom;\r
1519 \r
1520         if (fWidth > 0.0f)\r
1521         {\r
1522                 FX_FLOAT fHalfWidth = fWidth / 2.0f;\r
1523 \r
1524                 switch (nStyle)\r
1525                 {\r
1526                 default:\r
1527                 case PBS_SOLID:\r
1528                         {\r
1529                                 CFX_PathData path;\r
1530                                 path.AppendRect(fLeft, fBottom, fRight, fTop);\r
1531                                 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, fTop - fWidth);\r
1532                                 pDevice->DrawPath(&path, pUser2Device, NULL, PWLColorToFXColor(color,nTransparancy), 0, FXFILL_ALTERNATE);\r
1533                         }\r
1534                         break;\r
1535                 case PBS_DASH:\r
1536                         {\r
1537                                 CFX_PathData path;\r
1538 \r
1539                                 path.SetPointCount(5);\r
1540                                 path.SetPoint(0, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, FXPT_MOVETO);\r
1541                                 path.SetPoint(1, fLeft + fWidth / 2.0f, fTop - fWidth / 2.0f, FXPT_LINETO);\r
1542                                 path.SetPoint(2, fRight - fWidth / 2.0f, fTop - fWidth / 2.0f, FXPT_LINETO);\r
1543                                 path.SetPoint(3, fRight - fWidth / 2.0f, fBottom + fWidth / 2.0f, FXPT_LINETO);\r
1544                                 path.SetPoint(4, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, FXPT_LINETO);\r
1545 \r
1546                                 CFX_GraphStateData gsd;\r
1547                                 gsd.SetDashCount(2);                            \r
1548                                 gsd.m_DashArray[0] = 3.0f;\r
1549                                 gsd.m_DashArray[1] = 3.0f;\r
1550                                 gsd.m_DashPhase = 0;    \r
1551                                 \r
1552                                 gsd.m_LineWidth = fWidth;\r
1553                                 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, PWLColorToFXColor(color,nTransparancy), FXFILL_WINDING);                                \r
1554                         }                       \r
1555                         break;\r
1556                 case PBS_BEVELED:\r
1557                 case PBS_INSET: \r
1558                         {\r
1559                                 CFX_GraphStateData gsd;\r
1560                                 gsd.m_LineWidth = fHalfWidth;\r
1561 \r
1562                                 CFX_PathData pathLT;\r
1563 \r
1564                                 pathLT.SetPointCount(7);\r
1565                                 pathLT.SetPoint(0, fLeft + fHalfWidth, fBottom + fHalfWidth, FXPT_MOVETO);\r
1566                                 pathLT.SetPoint(1, fLeft + fHalfWidth, fTop - fHalfWidth, FXPT_LINETO);\r
1567                                 pathLT.SetPoint(2, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_LINETO);\r
1568                                 pathLT.SetPoint(3, fRight - fHalfWidth * 2, fTop - fHalfWidth * 2, FXPT_LINETO);\r
1569                                 pathLT.SetPoint(4, fLeft + fHalfWidth * 2, fTop - fHalfWidth * 2, FXPT_LINETO);\r
1570                                 pathLT.SetPoint(5, fLeft + fHalfWidth * 2, fBottom + fHalfWidth * 2, FXPT_LINETO);\r
1571                                 pathLT.SetPoint(6, fLeft + fHalfWidth, fBottom + fHalfWidth, FXPT_LINETO);\r
1572 \r
1573                                 pDevice->DrawPath(&pathLT, pUser2Device, &gsd, PWLColorToFXColor(crLeftTop,nTransparancy), 0, FXFILL_ALTERNATE);\r
1574 \r
1575                                 CFX_PathData pathRB;\r
1576 \r
1577                                 pathRB.SetPointCount(7);\r
1578                                 pathRB.SetPoint(0, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_MOVETO);\r
1579                                 pathRB.SetPoint(1, fRight - fHalfWidth, fBottom + fHalfWidth, FXPT_LINETO);\r
1580                                 pathRB.SetPoint(2, fLeft + fHalfWidth, fBottom + fHalfWidth, FXPT_LINETO);\r
1581                                 pathRB.SetPoint(3, fLeft + fHalfWidth * 2, fBottom + fHalfWidth * 2, FXPT_LINETO);\r
1582                                 pathRB.SetPoint(4, fRight - fHalfWidth * 2, fBottom + fHalfWidth * 2, FXPT_LINETO);\r
1583                                 pathRB.SetPoint(5, fRight - fHalfWidth * 2, fTop - fHalfWidth * 2, FXPT_LINETO);\r
1584                                 pathRB.SetPoint(6, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_LINETO);\r
1585 \r
1586                                 pDevice->DrawPath(&pathRB, pUser2Device, &gsd, PWLColorToFXColor(crRightBottom,nTransparancy), 0, FXFILL_ALTERNATE);\r
1587 \r
1588                                 CFX_PathData path;\r
1589 \r
1590                                 path.AppendRect(fLeft, fBottom, fRight, fTop);\r
1591                                 path.AppendRect(fLeft + fHalfWidth, fBottom + fHalfWidth, fRight - fHalfWidth, fTop - fHalfWidth);\r
1592 \r
1593                                 pDevice->DrawPath(&path, pUser2Device, &gsd, PWLColorToFXColor(color,nTransparancy), 0, FXFILL_ALTERNATE);\r
1594                         }\r
1595                         break;\r
1596                 case PBS_UNDERLINED:\r
1597                         {\r
1598                                 CFX_PathData path;\r
1599 \r
1600                                 path.SetPointCount(2);\r
1601                                 path.SetPoint(0, fLeft, fBottom + fWidth / 2, FXPT_MOVETO);\r
1602                                 path.SetPoint(1, fRight, fBottom + fWidth / 2, FXPT_LINETO);\r
1603                                 \r
1604                                 CFX_GraphStateData gsd;\r
1605                                 gsd.m_LineWidth = fWidth;\r
1606 \r
1607                                 pDevice->DrawPath(&path, pUser2Device, &gsd,0,  PWLColorToFXColor(color,nTransparancy), FXFILL_ALTERNATE);\r
1608                         }\r
1609                         break;\r
1610                 case PBS_SHADOW:\r
1611                         {\r
1612                                 CFX_PathData path;\r
1613                                 path.AppendRect(fLeft, fBottom, fRight, fTop);\r
1614                                 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, fTop - fWidth);\r
1615                                 pDevice->DrawPath(&path, pUser2Device, NULL, PWLColorToFXColor(color,nTransparancy/2), 0, FXFILL_ALTERNATE);\r
1616                         }\r
1617                         break;\r
1618                 }\r
1619         }\r
1620 }\r
1621 \r
1622 static void AddSquigglyPath(CFX_PathData & PathData, FX_FLOAT fStartX, FX_FLOAT fEndX, FX_FLOAT fY, FX_FLOAT fStep)\r
1623 {\r
1624         PathData.AddPointCount(1);\r
1625         PathData.SetPoint(PathData.GetPointCount() - 1, fStartX, fY, FXPT_MOVETO);\r
1626 \r
1627         FX_FLOAT fx;\r
1628         FX_INT32 i;\r
1629 \r
1630         for (i=1,fx=fStartX+fStep; fx<fEndX; fx+=fStep,i++)\r
1631         {\r
1632                 PathData.AddPointCount(1);\r
1633                 PathData.SetPoint(PathData.GetPointCount() - 1, fx, fY + (i&1)*fStep, FXPT_LINETO);\r
1634         }\r
1635 }\r
1636 \r
1637 static void AddSpellCheckObj(CFX_PathData & PathData, IFX_Edit* pEdit, const CPVT_WordRange& wrWord)\r
1638 {\r
1639         FX_FLOAT fStartX = 0.0f;\r
1640         FX_FLOAT fEndX = 0.0f;\r
1641         FX_FLOAT fY = 0.0f;\r
1642         FX_FLOAT fStep = 0.0f; \r
1643 \r
1644         FX_BOOL bBreak = FALSE;\r
1645 \r
1646         if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator())\r
1647         {\r
1648                 pIterator->SetAt(wrWord.BeginPos);\r
1649 \r
1650                 do\r
1651                 {\r
1652                         CPVT_WordPlace place = pIterator->GetAt();\r
1653 \r
1654                         CPVT_Line line;                         \r
1655                         if (pIterator->GetLine(line))\r
1656                         {\r
1657                                 fY = line.ptLine.y;\r
1658                                 fStep = (line.fLineAscent - line.fLineDescent) / 16.0f;\r
1659                         }\r
1660 \r
1661                         if (place.LineCmp(wrWord.BeginPos) == 0)\r
1662                         {\r
1663                                 pIterator->SetAt(wrWord.BeginPos);\r
1664                                 CPVT_Word word;\r
1665                                 if (pIterator->GetWord(word))\r
1666                                 {\r
1667                                         fStartX = word.ptWord.x;\r
1668                                 }\r
1669                         }\r
1670                         else\r
1671                         {\r
1672                                 fStartX = line.ptLine.x;\r
1673                         }\r
1674 \r
1675                         if (place.LineCmp(wrWord.EndPos) == 0)\r
1676                         {\r
1677                                 pIterator->SetAt(wrWord.EndPos);\r
1678                                 CPVT_Word word;\r
1679                                 if (pIterator->GetWord(word))\r
1680                                 {\r
1681                                         fEndX = word.ptWord.x + word.fWidth;\r
1682                                 }\r
1683 \r
1684                                 bBreak = TRUE;\r
1685                         }\r
1686                         else\r
1687                         {\r
1688                                 fEndX = line.ptLine.x + line.fLineWidth;\r
1689                         }\r
1690 \r
1691                         AddSquigglyPath(PathData, fStartX, fEndX, fY, fStep);\r
1692 \r
1693                         if (bBreak) break;\r
1694                 }\r
1695                 while (pIterator->NextLine());\r
1696         }\r
1697 }\r
1698 \r
1699 void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, \r
1700                                                 const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, \r
1701                                                 IPWL_SpellCheck * pSpellCheck)\r
1702 {\r
1703         const FX_COLORREF crSpell = ArgbEncode(255,255,0,0);\r
1704 \r
1705         //for spellcheck\r
1706         FX_BOOL bLatinWord = FALSE;\r
1707         CPVT_WordPlace wpWordStart;\r
1708         CFX_ByteString sLatinWord;\r
1709 \r
1710         CFX_PathData pathSpell;\r
1711 \r
1712         pDevice->SaveState();\r
1713 \r
1714         if (!rcClip.IsEmpty())\r
1715         {\r
1716                 CPDF_Rect rcTemp = rcClip;\r
1717                 pUser2Device->TransformRect(rcTemp);\r
1718                 FX_RECT rcDevClip;\r
1719                 rcDevClip.left = (FX_INT32)rcTemp.left;\r
1720                 rcDevClip.right = (FX_INT32)rcTemp.right;\r
1721                 rcDevClip.top = (FX_INT32)rcTemp.top;\r
1722                 rcDevClip.bottom = (FX_INT32)rcTemp.bottom;\r
1723                 pDevice->SetClip_Rect(&rcDevClip);\r
1724         }\r
1725 \r
1726         if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator())\r
1727         {\r
1728                 if (pEdit->GetFontMap())\r
1729                 {\r
1730                         if (pRange)\r
1731                                 pIterator->SetAt(pRange->BeginPos);\r
1732                         else\r
1733                                 pIterator->SetAt(0);\r
1734 \r
1735                         CPVT_WordPlace oldplace;                        \r
1736 \r
1737                         while (pIterator->NextWord())\r
1738                         {\r
1739                                 CPVT_WordPlace place = pIterator->GetAt();\r
1740                                 if (pRange && place.WordCmp(pRange->EndPos) > 0) break;                         \r
1741 \r
1742                                 CPVT_Word word;                         \r
1743                                 if (pIterator->GetWord(word))\r
1744                                 {\r
1745                                         if (FX_EDIT_ISLATINWORD(word.Word))\r
1746                                         {\r
1747                                                 if (!bLatinWord)\r
1748                                                 {\r
1749                                                         wpWordStart = place;\r
1750                                                         bLatinWord = TRUE;                                                              \r
1751                                                 }\r
1752 \r
1753                                                 sLatinWord += (char)word.Word;\r
1754                                         }\r
1755                                         else\r
1756                                         {\r
1757                                                 if (bLatinWord)\r
1758                                                 {\r
1759                                                         if (!sLatinWord.IsEmpty())\r
1760                                                         {\r
1761                                                                 if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord))\r
1762                                                                 {\r
1763                                                                         AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace));                                                                 \r
1764                                                                         pIterator->SetAt(place);\r
1765                                                                 }\r
1766                                                         }\r
1767                                                         bLatinWord = FALSE;\r
1768                                                 }\r
1769 \r
1770                                                 sLatinWord.Empty();\r
1771                                         }\r
1772                                         \r
1773                                         oldplace = place;\r
1774                                 }\r
1775                                 else\r
1776                                 {\r
1777                                         if (bLatinWord)\r
1778                                         {\r
1779                                                 if (!sLatinWord.IsEmpty())\r
1780                                                 {\r
1781                                                         if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord))\r
1782                                                         {\r
1783                                                                 AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace));                                                                 \r
1784                                                                 pIterator->SetAt(place);\r
1785                                                         }\r
1786                                                 }\r
1787                                                 bLatinWord = FALSE;\r
1788                                         }\r
1789 \r
1790                                         sLatinWord.Empty();\r
1791                                 }\r
1792                         }\r
1793 \r
1794                         if (!sLatinWord.IsEmpty()) \r
1795                         {\r
1796                                 if (pSpellCheck && !pSpellCheck->CheckWord(sLatinWord))\r
1797                                 {\r
1798                                         AddSpellCheckObj(pathSpell,pEdit,CPVT_WordRange(wpWordStart,oldplace)); \r
1799                                 }\r
1800                         }\r
1801                 }\r
1802         }\r
1803         \r
1804         CFX_GraphStateData gsd;\r
1805         gsd.m_LineWidth = 0;\r
1806         if (pathSpell.GetPointCount() > 0)\r
1807                 pDevice->DrawPath(&pathSpell, pUser2Device, &gsd, 0, crSpell, FXFILL_ALTERNATE);\r
1808 \r
1809         pDevice->RestoreState();\r
1810 }\r
1811 \r
1812 FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color)\r
1813 {\r
1814         switch (color.nColorType)\r
1815         {\r
1816         case COLORTYPE_TRANSPARENT:\r
1817                 return FALSE;\r
1818         case COLORTYPE_GRAY:\r
1819                 return color.fColor1 < 0.5f;\r
1820         case COLORTYPE_RGB:\r
1821                 return color.fColor1 + color.fColor2 + color.fColor3 < 1.5f;\r
1822         case COLORTYPE_CMYK:\r
1823                 return color.fColor1 + color.fColor2 + color.fColor3 + color.fColor4 > 2.0f;\r
1824         }\r
1825 \r
1826         return TRUE;\r
1827 }\r
1828 \r
1829 CPWL_Color CPWL_Utils::GetReverseColor(const CPWL_Color& color)\r
1830 {\r
1831         CPWL_Color crRet = color;\r
1832 \r
1833         switch (color.nColorType)\r
1834         {\r
1835         case COLORTYPE_GRAY:\r
1836                 crRet.fColor1 = 1.0f - crRet.fColor1;\r
1837                 break;\r
1838         case COLORTYPE_RGB:\r
1839                 crRet.fColor1 = 1.0f - crRet.fColor1;\r
1840                 crRet.fColor2 = 1.0f - crRet.fColor2;\r
1841                 crRet.fColor3 = 1.0f - crRet.fColor3;\r
1842                 break;\r
1843         case COLORTYPE_CMYK:\r
1844                 crRet.fColor1 = 1.0f - crRet.fColor1;\r
1845                 crRet.fColor2 = 1.0f - crRet.fColor2;\r
1846                 crRet.fColor3 = 1.0f - crRet.fColor3;\r
1847                 crRet.fColor4 = 1.0f - crRet.fColor4;\r
1848                 break;\r
1849         }\r
1850 \r
1851         return crRet;\r
1852 }\r
1853 \r
1854 CFX_ByteString CPWL_Utils::GetIconAppStream(FX_INT32 nType, const CPDF_Rect& rect, const CPWL_Color& crFill, \r
1855                                                                                                 const CPWL_Color& crStroke)\r
1856 {\r
1857         CFX_ByteString sAppStream = CPWL_Utils::GetColorAppStream(crStroke, FALSE);\r
1858         sAppStream += CPWL_Utils::GetColorAppStream(crFill, TRUE);\r
1859 \r
1860         CFX_ByteString sPath;\r
1861         CFX_PathData path;\r
1862 \r
1863         switch (nType)\r
1864         {\r
1865         case PWL_ICONTYPE_CHECKMARK:\r
1866                 GetGraphics_Checkmark(sPath, path, rect, PWLPT_STREAM); \r
1867                 break;\r
1868         case PWL_ICONTYPE_CIRCLE:\r
1869                 GetGraphics_Circle(sPath, path, rect, PWLPT_STREAM);\r
1870                 break;\r
1871         case PWL_ICONTYPE_COMMENT:\r
1872                 GetGraphics_Comment(sPath, path, rect, PWLPT_STREAM);\r
1873                 break;\r
1874         case PWL_ICONTYPE_CROSS:\r
1875                 GetGraphics_Cross(sPath, path, rect, PWLPT_STREAM);\r
1876                 break;\r
1877         case PWL_ICONTYPE_HELP:\r
1878                 GetGraphics_Help(sPath, path, rect, PWLPT_STREAM);\r
1879                 break;\r
1880         case PWL_ICONTYPE_INSERTTEXT:\r
1881                 GetGraphics_InsertText(sPath, path, rect, PWLPT_STREAM);\r
1882                 break;\r
1883         case PWL_ICONTYPE_KEY:\r
1884                 GetGraphics_Key(sPath, path, rect, PWLPT_STREAM);\r
1885                 break;\r
1886         case PWL_ICONTYPE_NEWPARAGRAPH:\r
1887                 GetGraphics_NewParagraph(sPath, path, rect, PWLPT_STREAM);\r
1888                 break;\r
1889         case PWL_ICONTYPE_TEXTNOTE:\r
1890                 GetGraphics_TextNote(sPath, path, rect, PWLPT_STREAM);\r
1891                 break;\r
1892         case PWL_ICONTYPE_PARAGRAPH:\r
1893                 GetGraphics_Paragraph(sPath, path, rect, PWLPT_STREAM);\r
1894                 break;\r
1895         case PWL_ICONTYPE_RIGHTARROW:\r
1896                 GetGraphics_RightArrow(sPath, path, rect, PWLPT_STREAM);\r
1897                 break;\r
1898         case PWL_ICONTYPE_RIGHTPOINTER:\r
1899                 GetGraphics_RightPointer(sPath, path, rect, PWLPT_STREAM);\r
1900                 break;\r
1901         case PWL_ICONTYPE_STAR:\r
1902                 GetGraphics_Star(sPath, path, rect, PWLPT_STREAM);\r
1903                 break;\r
1904         case PWL_ICONTYPE_UPARROW:\r
1905                 GetGraphics_UpArrow(sPath, path, rect, PWLPT_STREAM);\r
1906                 break;\r
1907         case PWL_ICONTYPE_UPLEFTARROW:\r
1908                 GetGraphics_UpLeftArrow(sPath, path, rect, PWLPT_STREAM);\r
1909                 break;\r
1910         case PWL_ICONTYPE_GRAPH:\r
1911                 GetGraphics_Graph(sPath, path, rect, PWLPT_STREAM);\r
1912                 break;\r
1913         case PWL_ICONTYPE_PAPERCLIP:\r
1914                 GetGraphics_Paperclip(sPath, path, rect, PWLPT_STREAM);\r
1915                 break;\r
1916         case PWL_ICONTYPE_ATTACHMENT:\r
1917                 GetGraphics_Attachment(sPath, path, rect, PWLPT_STREAM);\r
1918                 break;\r
1919         case PWL_ICONTYPE_TAG:\r
1920                 GetGraphics_Tag(sPath, path, rect, PWLPT_STREAM);\r
1921                 break;\r
1922         case PWL_ICONTYPE_FOXIT:\r
1923                 GetGraphics_Foxit(sPath, path, rect, PWLPT_STREAM);\r
1924                 break;\r
1925         }\r
1926 \r
1927         sAppStream += sPath;\r
1928         if (crStroke.nColorType != COLORTYPE_TRANSPARENT)\r
1929                 sAppStream += "B*\n";\r
1930         else\r
1931                 sAppStream += "f*\n";\r
1932 \r
1933         return sAppStream;\r
1934 }\r
1935 \r
1936 void CPWL_Utils::DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,\r
1937                                                 FX_INT32 nType, const CPDF_Rect & rect, const CPWL_Color& crFill, const CPWL_Color& crStroke, const FX_INT32 nTransparancy)\r
1938 {\r
1939         CFX_GraphStateData gsd;\r
1940         gsd.m_LineWidth = 1.0f;\r
1941 \r
1942         CFX_ByteString sPath;\r
1943         CFX_PathData path;\r
1944 \r
1945         switch (nType)\r
1946         {\r
1947         case PWL_ICONTYPE_CHECKMARK:\r
1948                 GetGraphics_Checkmark(sPath, path, rect, PWLPT_PATHDATA);\r
1949                 break;\r
1950         case PWL_ICONTYPE_CIRCLE:\r
1951                 GetGraphics_Circle(sPath, path, rect, PWLPT_PATHDATA);\r
1952                 break;\r
1953         case PWL_ICONTYPE_COMMENT:\r
1954                 GetGraphics_Comment(sPath, path, rect, PWLPT_PATHDATA);\r
1955                 break;\r
1956         case PWL_ICONTYPE_CROSS:\r
1957                 GetGraphics_Cross(sPath, path, rect, PWLPT_PATHDATA);\r
1958                 break;\r
1959         case PWL_ICONTYPE_HELP:\r
1960                 GetGraphics_Help(sPath, path, rect, PWLPT_PATHDATA);\r
1961                 break;\r
1962         case PWL_ICONTYPE_INSERTTEXT:\r
1963                 GetGraphics_InsertText(sPath, path, rect, PWLPT_PATHDATA);\r
1964                 break;\r
1965         case PWL_ICONTYPE_KEY:\r
1966                 GetGraphics_Key(sPath, path, rect, PWLPT_PATHDATA);\r
1967                 break;\r
1968         case PWL_ICONTYPE_NEWPARAGRAPH:\r
1969                 GetGraphics_NewParagraph(sPath, path, rect, PWLPT_PATHDATA);\r
1970                 break;\r
1971         case PWL_ICONTYPE_TEXTNOTE:\r
1972                 GetGraphics_TextNote(sPath, path, rect, PWLPT_PATHDATA);\r
1973                 break;\r
1974         case PWL_ICONTYPE_PARAGRAPH:\r
1975                 GetGraphics_Paragraph(sPath, path, rect, PWLPT_PATHDATA);\r
1976                 break;\r
1977         case PWL_ICONTYPE_RIGHTARROW:\r
1978                 GetGraphics_RightArrow(sPath, path, rect, PWLPT_PATHDATA);\r
1979                 break;\r
1980         case PWL_ICONTYPE_RIGHTPOINTER:\r
1981                 GetGraphics_RightPointer(sPath, path, rect, PWLPT_PATHDATA);\r
1982                 break;\r
1983         case PWL_ICONTYPE_STAR:\r
1984                 GetGraphics_Star(sPath, path, rect, PWLPT_PATHDATA);\r
1985                 break;\r
1986         case PWL_ICONTYPE_UPARROW:\r
1987                 GetGraphics_UpArrow(sPath, path, rect, PWLPT_PATHDATA);\r
1988                 break;\r
1989         case PWL_ICONTYPE_UPLEFTARROW:\r
1990                 GetGraphics_UpLeftArrow(sPath, path, rect, PWLPT_PATHDATA);\r
1991                 break;\r
1992         case PWL_ICONTYPE_GRAPH:\r
1993                 GetGraphics_Graph(sPath, path, rect, PWLPT_PATHDATA);\r
1994                 break;\r
1995         case PWL_ICONTYPE_PAPERCLIP:\r
1996                 GetGraphics_Paperclip(sPath, path, rect, PWLPT_PATHDATA);\r
1997                 break;\r
1998         case PWL_ICONTYPE_ATTACHMENT:\r
1999                 GetGraphics_Attachment(sPath, path, rect, PWLPT_PATHDATA);\r
2000                 break;\r
2001         case PWL_ICONTYPE_TAG:\r
2002                 GetGraphics_Tag(sPath, path, rect, PWLPT_PATHDATA);\r
2003                 break;\r
2004         case PWL_ICONTYPE_FOXIT:\r
2005                 GetGraphics_Foxit(sPath, path, rect, PWLPT_PATHDATA);\r
2006                 break;\r
2007         default:\r
2008                 return;\r
2009         }\r
2010 \r
2011         pDevice->DrawPath(&path, pUser2Device, &gsd, \r
2012                 PWLColorToFXColor(crFill,nTransparancy), PWLColorToFXColor(crStroke,nTransparancy), FXFILL_ALTERNATE);\r
2013 }\r
2014 \r
2015 void CPWL_Utils::GetGraphics_Checkmark(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2016 {\r
2017         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2018         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2019 \r
2020         CPWL_PathData PathArray[] = \r
2021         {\r
2022                 CPWL_PathData(CPWL_Point(crBBox.left  + fWidth / 15.0f, crBBox.bottom + fHeight * 2 / 5.0f),PWLPT_MOVETO),\r
2023                 CPWL_PathData(CPWL_Point(crBBox.left  + fWidth / 15.0f + PWL_BEZIER*(fWidth / 7.0f - fWidth / 15.0f), \r
2024                                           crBBox.bottom + fHeight * 2 / 5.0f + PWL_BEZIER*(fHeight * 2 / 7.0f - fHeight * 2 / 5.0f)), PWLPT_BEZIERTO),\r
2025                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 4.5f + PWL_BEZIER*(fWidth / 5.0f - fWidth / 4.5f),\r
2026                                           crBBox.bottom + fHeight / 16.0f + PWL_BEZIER*(fHeight / 5.0f - fHeight / 16.0f)), PWLPT_BEZIERTO),\r
2027                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 4.5f, crBBox.bottom + fHeight / 16.0f), PWLPT_BEZIERTO),\r
2028                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 4.5f + PWL_BEZIER*(fWidth / 4.4f - fWidth / 4.5f),\r
2029                               crBBox.bottom + fHeight / 16.0f - PWL_BEZIER*fHeight / 16.0f), PWLPT_BEZIERTO),\r
2030                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.0f + PWL_BEZIER*(fWidth / 4.0f - fWidth / 3.0f),\r
2031                               crBBox.bottom), PWLPT_BEZIERTO),\r
2032                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.0f, crBBox.bottom), PWLPT_BEZIERTO),\r
2033                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.0f + PWL_BEZIER*fWidth*(1/7.0f + 2/15.0f),\r
2034                               crBBox.bottom + PWL_BEZIER*fHeight * 4 / 5.0f), PWLPT_BEZIERTO),\r
2035                 CPWL_PathData(CPWL_Point(crBBox.left  + fWidth * 14 / 15.0f + PWL_BEZIER*fWidth*(1/7.0f - 7/15.0f),\r
2036                               crBBox.bottom + fHeight * 15/16.0f + PWL_BEZIER*(fHeight * 4/5.0f - fHeight * 15/16.0f)), PWLPT_BEZIERTO),\r
2037                 CPWL_PathData(CPWL_Point(crBBox.left  + fWidth * 14 / 15.0f,crBBox.bottom + fHeight * 15 / 16.0f), PWLPT_BEZIERTO),\r
2038                 CPWL_PathData(CPWL_Point(crBBox.left  + fWidth * 14 / 15.0f + PWL_BEZIER*(fWidth * 7 / 15.0f - fWidth * 14 / 15.0f),\r
2039                               crBBox.bottom + fHeight * 15 / 16.0f + PWL_BEZIER*(fHeight * 8 / 7.0f - fHeight * 15 / 16.0f)), PWLPT_BEZIERTO),\r
2040                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.6f + PWL_BEZIER*(fWidth / 3.4f - fWidth / 3.6f),\r
2041                               crBBox.bottom + fHeight / 3.5f + PWL_BEZIER*(fHeight / 3.5f - fHeight / 3.5f)), PWLPT_BEZIERTO),\r
2042                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.6f,crBBox.bottom + fHeight / 3.5f), PWLPT_BEZIERTO),\r
2043                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth / 3.6f,\r
2044                               crBBox.bottom + fHeight / 3.5f + PWL_BEZIER*(fHeight / 4.0f - fHeight / 3.5f)), PWLPT_BEZIERTO),\r
2045                 CPWL_PathData(CPWL_Point(crBBox.left  + fWidth / 15.0f + PWL_BEZIER*(fWidth / 3.5f - fWidth / 15.0f),\r
2046                               crBBox.bottom + fHeight * 2 / 5.0f + PWL_BEZIER*(fHeight * 3.5f / 5.0f - fHeight * 2 / 5.0f)), PWLPT_BEZIERTO),\r
2047                 CPWL_PathData(CPWL_Point(crBBox.left  + fWidth / 15.0f,crBBox.bottom + fHeight * 2 / 5.0f), PWLPT_BEZIERTO)\r
2048         };\r
2049 \r
2050         if(type == PWLPT_STREAM)\r
2051                 sPathData = GetAppStreamFromArray(PathArray, 16);\r
2052         else\r
2053                 GetPathDataFromArray(path, PathArray, 16);\r
2054 }\r
2055 \r
2056 void CPWL_Utils::GetGraphics_Circle(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2057 {\r
2058         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2059         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2060 \r
2061         CPWL_PathData PathArray[] =\r
2062         {\r
2063                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f,crBBox.bottom + fHeight/2.0f), PWLPT_MOVETO),\r
2064                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f,\r
2065                               crBBox.bottom + fHeight/2.0f + PWL_BEZIER*(fHeight*14/15.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2066                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f - PWL_BEZIER*(fWidth/2.0f - fWidth/15.0f), crBBox.top - fHeight/15.0f), PWLPT_BEZIERTO),\r
2067                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f,crBBox.top - fHeight/15.0f), PWLPT_BEZIERTO),\r
2068                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + PWL_BEZIER*(fWidth*14/15.0f - fWidth/2.0f), crBBox.top - fHeight/15.0f), PWLPT_BEZIERTO),\r
2069                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*(fHeight*14/15.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2070                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO),\r
2071                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.bottom + fHeight/2.0f - PWL_BEZIER*(fHeight/2.0f - fHeight/15.0f)), PWLPT_BEZIERTO),\r
2072                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + PWL_BEZIER*(fWidth*14/15.0f - fWidth/2.0f), crBBox.bottom + fHeight/15.0f), PWLPT_BEZIERTO),\r
2073                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.bottom + fHeight/15.0f), PWLPT_BEZIERTO),\r
2074                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f - PWL_BEZIER*(fWidth/2.0f - fWidth/15.0f), crBBox.bottom + fHeight/15.0f), PWLPT_BEZIERTO),\r
2075                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.bottom + fHeight/2.0f - PWL_BEZIER*(fHeight/2.0f - fHeight/15.0f)), PWLPT_BEZIERTO),\r
2076                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f,crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO),\r
2077                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*3/15.0f, crBBox.bottom + fHeight/2.0f), PWLPT_MOVETO),\r
2078                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*3/15.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*(fHeight*4/5.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2079                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f - PWL_BEZIER*(fWidth/2.0f - fWidth*3/15.0f), crBBox.top - fHeight*3/15.0f), PWLPT_BEZIERTO),\r
2080                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight*3/15.0f), PWLPT_BEZIERTO),\r
2081                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + PWL_BEZIER*(fWidth*4/5.0f - fWidth/2.0f), crBBox.top - fHeight*3/15.0f), PWLPT_BEZIERTO),\r
2082                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/15.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*(fHeight*4/5.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2083                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/15.0f, crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO),\r
2084                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/15.0f, crBBox.bottom + fHeight/2.0f - PWL_BEZIER*(fHeight*4/5.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2085                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + PWL_BEZIER*(fWidth*4/5.0f - fWidth/2.0f), crBBox.bottom + fHeight*3/15.0f), PWLPT_BEZIERTO),\r
2086                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.bottom + fHeight*3/15.0f), PWLPT_BEZIERTO),\r
2087                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f - PWL_BEZIER*(fWidth*4/5.0f - fWidth/2.0f), crBBox.bottom + fHeight*3/15.0f), PWLPT_BEZIERTO),\r
2088                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*3/15.0f, crBBox.bottom + fHeight/2.0f - PWL_BEZIER*(fHeight*4/5.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2089                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*3/15.0f, crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO)\r
2090         };\r
2091 \r
2092         if(type == PWLPT_STREAM)\r
2093                 sPathData = GetAppStreamFromArray(PathArray, 26);\r
2094         else\r
2095                 GetPathDataFromArray(path, PathArray, 26);\r
2096 }\r
2097 \r
2098 void CPWL_Utils::GetGraphics_Comment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2099 {\r
2100         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2101         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2102 \r
2103         CPWL_PathData PathArray[] = \r
2104         {\r
2105                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.top - fHeight/6.0f), PWLPT_MOVETO),\r
2106                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.top - fHeight/6.0f + PWL_BEZIER*(fHeight/6.0f - fHeight/10.0f)), PWLPT_BEZIERTO),\r
2107                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*2/15.0f - PWL_BEZIER*fWidth/15.0f, crBBox.top - fHeight/10.0f), PWLPT_BEZIERTO),\r
2108                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*2/15.0f, crBBox.top - fHeight/10.0f), PWLPT_BEZIERTO),\r
2109                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*2/15.0f, crBBox.top - fHeight/10.0f), PWLPT_LINETO),\r
2110                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*2/15.0f + PWL_BEZIER*fWidth/15.0f, crBBox.top - fHeight/10.0f), PWLPT_BEZIERTO),\r
2111                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.top - fHeight/6 + PWL_BEZIER*(fHeight/6.0f - fHeight/10.0f)), PWLPT_BEZIERTO),\r
2112                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.top - fHeight/6.0f), PWLPT_BEZIERTO),\r
2113                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.bottom + fHeight/3.0f), PWLPT_LINETO),\r
2114                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.bottom + fHeight*4/15.0f + PWL_BEZIER*fHeight/15.0f), PWLPT_BEZIERTO),\r
2115                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*2/15.0f + PWL_BEZIER*fWidth/15.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_BEZIERTO),\r
2116                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*2/15.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_BEZIERTO),\r
2117                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*5/15.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO),\r
2118                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*5/15.0f, crBBox.bottom + fHeight*2/15 + PWL_BEZIER*fHeight*2/15.0f), PWLPT_BEZIERTO),\r
2119                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*5/15.0f - PWL_BEZIER*fWidth*2/15.0f, crBBox.bottom + fHeight*2/15.0f), PWLPT_BEZIERTO),\r
2120                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*6/30.0f, crBBox.bottom + fHeight*2/15.0f), PWLPT_BEZIERTO),\r
2121                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*7/30.0f + PWL_BEZIER*fWidth/30.0f, crBBox.bottom + fHeight*2/15.0f), PWLPT_BEZIERTO),\r
2122                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*7/30.0f, crBBox.bottom + fHeight*2/15.0f + PWL_BEZIER*fHeight*2/15.0f), PWLPT_BEZIERTO),\r
2123                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*7/30.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_BEZIERTO),\r
2124                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*2/15.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO),\r
2125                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*2/15.0f - PWL_BEZIER*fWidth/15.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_BEZIERTO),\r
2126                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.bottom + fHeight/3.0f - PWL_BEZIER*fHeight/15.0f), PWLPT_BEZIERTO),\r
2127                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.bottom + fHeight/3.0f), PWLPT_BEZIERTO),\r
2128                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/15.0f, crBBox.top - fHeight/6.0f), PWLPT_LINETO),\r
2129                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*2/15.0f, crBBox.top - fHeight*8/30.0f), PWLPT_MOVETO),\r
2130                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*2/15.0f, crBBox.top - fHeight*8/30.0f), PWLPT_LINETO),\r
2131                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*2/15, crBBox.top - fHeight*25/60.0f), PWLPT_MOVETO),\r
2132                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*2/15.0f, crBBox.top - fHeight*25/60.0f), PWLPT_LINETO),\r
2133                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*2/15.0f, crBBox.top - fHeight*17/30.0f), PWLPT_MOVETO),\r
2134                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*4/15.0f, crBBox.top - fHeight*17/30.0f), PWLPT_LINETO)\r
2135         };\r
2136 \r
2137         if(type == PWLPT_STREAM)\r
2138                 sPathData = GetAppStreamFromArray(PathArray, 30);\r
2139         else\r
2140                 GetPathDataFromArray(path, PathArray, 30);\r
2141 }\r
2142 \r
2143 void CPWL_Utils::GetGraphics_Cross(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2144 {\r
2145         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2146         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2147         //FX_FLOAT fcatercorner = (FX_FLOAT)sqrt(fWidth*fWidth + fHeight*fHeight);\r
2148         CPWL_Point center_point(crBBox.left + fWidth/2, crBBox.bottom + fHeight/2);\r
2149 \r
2150         CPWL_PathData PathArray[] = \r
2151         {\r
2152                 CPWL_PathData(CPWL_Point(center_point.x, center_point.y + fHeight/10.0f), PWLPT_MOVETO),\r
2153                 CPWL_PathData(CPWL_Point(center_point.x + fWidth*0.3f, center_point.y + fHeight/10.0f + fWidth*0.3f), PWLPT_LINETO),\r
2154                 CPWL_PathData(CPWL_Point(center_point.x + fWidth/10.0f + fWidth*0.3f, center_point.y + fHeight*0.3f), PWLPT_LINETO),\r
2155                 CPWL_PathData(CPWL_Point(center_point.x + fWidth/10.0f, center_point.y), PWLPT_LINETO),\r
2156                 CPWL_PathData(CPWL_Point(center_point.x + fWidth/10.0f + fWidth*0.3f, center_point.y - fHeight*0.3f), PWLPT_LINETO),\r
2157                 CPWL_PathData(CPWL_Point(center_point.x + fWidth*0.3f, center_point.y - fHeight/10.0f - fHeight*0.3f), PWLPT_LINETO),\r
2158                 CPWL_PathData(CPWL_Point(center_point.x, center_point.y - fHeight/10.0f), PWLPT_LINETO),\r
2159                 CPWL_PathData(CPWL_Point(center_point.x - fWidth*0.3f, center_point.y - fHeight/10 - fHeight*0.3f), PWLPT_LINETO),\r
2160                 CPWL_PathData(CPWL_Point(center_point.x - fWidth/10.0f - fWidth*0.3f, center_point.y - fHeight*0.3f), PWLPT_LINETO),\r
2161                 CPWL_PathData(CPWL_Point(center_point.x - fWidth/10, center_point.y), PWLPT_LINETO),\r
2162                 CPWL_PathData(CPWL_Point(center_point.x - fWidth/10 - fWidth*0.3f, center_point.y + fHeight*0.3f), PWLPT_LINETO),\r
2163                 CPWL_PathData(CPWL_Point(center_point.x - fWidth*0.3f, center_point.y + fHeight/10.0f + fHeight*0.3f), PWLPT_LINETO),\r
2164                 CPWL_PathData(CPWL_Point(center_point.x, center_point.y + fHeight/10.0f), PWLPT_LINETO)\r
2165         };\r
2166 \r
2167         if(type == PWLPT_STREAM)\r
2168                 sPathData = GetAppStreamFromArray(PathArray, 13);\r
2169         else\r
2170                 GetPathDataFromArray(path, PathArray, 13);\r
2171 }\r
2172 \r
2173 void CPWL_Utils::GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2174 {\r
2175         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2176         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2177 \r
2178         CPWL_PathData PathArray[] = \r
2179         {\r
2180                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f), PWLPT_MOVETO),\r
2181                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*(fHeight/60.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2182                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f - PWL_BEZIER*(fWidth/2.0f - fWidth/60.0f), crBBox.bottom + fHeight/60.0f), PWLPT_BEZIERTO),\r
2183                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.bottom + fHeight/60.0f), PWLPT_BEZIERTO),\r
2184                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + PWL_BEZIER*fWidth*29/60.0f, crBBox.bottom + fHeight/60.0f), PWLPT_BEZIERTO),\r
2185                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/60.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*(fHeight/60.0f - fHeight/2.0f)), PWLPT_BEZIERTO),\r
2186                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/60.0f, crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO),\r
2187                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/60.0f, crBBox.bottom + fHeight/2.0f + PWL_BEZIER*fHeight*29/60.0f), PWLPT_BEZIERTO),\r
2188                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + PWL_BEZIER*fWidth*29/60.0f, crBBox.top - fHeight/60.0f), PWLPT_BEZIERTO),\r
2189                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/60.0f), PWLPT_BEZIERTO),               \r
2190                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f - PWL_BEZIER*fWidth*29/60.0f, crBBox.top - fHeight/60.0f), PWLPT_BEZIERTO),\r
2191                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f  + PWL_BEZIER*fHeight*29/60.0f), PWLPT_BEZIERTO),\r
2192                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60.0f, crBBox.bottom + fHeight/2.0f), PWLPT_BEZIERTO),\r
2193                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f), PWLPT_MOVETO),\r
2194                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f + PWL_BEZIER*fHeight*0.23f), PWLPT_BEZIERTO),\r
2195                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f - PWL_BEZIER*fWidth*0.23f, crBBox.bottom + fHeight*0.87f), PWLPT_BEZIERTO),\r
2196                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.bottom + fHeight*0.87f), PWLPT_BEZIERTO),            \r
2197                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f + PWL_BEZIER*fWidth*0.23f, crBBox.bottom + fHeight*0.87f), PWLPT_BEZIERTO),\r
2198                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.27f, crBBox.top - fHeight*0.36f + PWL_BEZIER*fHeight*0.23f), PWLPT_BEZIERTO),\r
2199                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.27f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO),\r
2200                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.27f - fWidth*0.08f*0.2f, crBBox.top - fHeight*0.36f - fHeight*0.15f*0.7f), PWLPT_BEZIERTO),\r
2201                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.35f + fWidth*0.08f*0.2f, crBBox.top - fHeight*0.51f + fHeight*0.15f*0.2f), PWLPT_BEZIERTO),\r
2202                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.35f, crBBox.top - fHeight*0.51f), PWLPT_BEZIERTO),\r
2203                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.35f - fWidth*0.1f*0.5f, crBBox.top - fHeight*0.51f - fHeight*0.15f*0.3f), PWLPT_BEZIERTO),\r
2204                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.45f - fWidth*0.1f*0.5f, crBBox.top - fHeight*0.68f + fHeight*0.15f*0.5f), PWLPT_BEZIERTO),\r
2205                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.45f, crBBox.top - fHeight*0.68f), PWLPT_BEZIERTO),\r
2206                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.45f, crBBox.bottom + fHeight*0.30f), PWLPT_LINETO),\r
2207                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.45f, crBBox.bottom + fHeight*0.30f - fWidth*0.1f*0.7f), PWLPT_BEZIERTO),\r
2208                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.55f, crBBox.bottom + fHeight*0.30f - fWidth*0.1f*0.7f), PWLPT_BEZIERTO),\r
2209                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.55f, crBBox.bottom + fHeight*0.30f), PWLPT_BEZIERTO),\r
2210                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.55f, crBBox.top - fHeight*0.66f), PWLPT_LINETO),\r
2211                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.55f - fWidth*0.1f*0.05f, crBBox.top - fHeight*0.66f + fHeight*0.18f*0.5f), PWLPT_BEZIERTO),\r
2212                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.45f - fWidth*0.1f*0.05f, crBBox.top - fHeight*0.48f - fHeight*0.18f*0.3f), PWLPT_BEZIERTO),\r
2213                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.45f, crBBox.top - fHeight*0.48f), PWLPT_BEZIERTO),\r
2214                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.45f + fWidth*0.08f*0.2f, crBBox.top - fHeight*0.48f + fHeight*0.18f*0.2f), PWLPT_BEZIERTO),\r
2215                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.37f - fWidth*0.08f*0.2f, crBBox.top - fHeight*0.36f - fHeight*0.18f*0.7f), PWLPT_BEZIERTO),\r
2216                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.37f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO),\r
2217                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.37f, crBBox.top - fHeight*0.36f + PWL_BEZIER*fHeight*0.13f), PWLPT_BEZIERTO),\r
2218                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f + PWL_BEZIER*fWidth*0.13f, crBBox.bottom + fHeight*0.77f), PWLPT_BEZIERTO),\r
2219                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.bottom + fHeight*0.77f), PWLPT_BEZIERTO),\r
2220                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f - PWL_BEZIER*fWidth*0.13f, crBBox.bottom + fHeight*0.77f), PWLPT_BEZIERTO),\r
2221                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.37f, crBBox.top - fHeight*0.36f + PWL_BEZIER*fHeight*0.13f), PWLPT_BEZIERTO),\r
2222                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.37f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO),              \r
2223                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.37f, crBBox.top - fHeight*0.36f - fWidth*0.1f*0.6f), PWLPT_BEZIERTO),\r
2224                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f - fWidth*0.1f*0.6f), PWLPT_BEZIERTO),\r
2225                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.27f, crBBox.top - fHeight*0.36f), PWLPT_BEZIERTO),              \r
2226                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.56f, crBBox.bottom + fHeight*0.13f), PWLPT_MOVETO),\r
2227                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.56f, crBBox.bottom + fHeight*0.13f + PWL_BEZIER*fHeight*0.055f), PWLPT_BEZIERTO),\r
2228                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f - PWL_BEZIER*fWidth*0.095f, crBBox.bottom + fHeight*0.185f), PWLPT_BEZIERTO),\r
2229                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f, crBBox.bottom + fHeight*0.185f), PWLPT_BEZIERTO),                \r
2230                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f + PWL_BEZIER*fWidth*0.065f, crBBox.bottom + fHeight*0.185f), PWLPT_BEZIERTO),\r
2231                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.44f, crBBox.bottom + fHeight*0.13f + PWL_BEZIER*fHeight*0.055f), PWLPT_BEZIERTO),\r
2232                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.44f, crBBox.bottom + fHeight*0.13f), PWLPT_BEZIERTO),\r
2233                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.44f, crBBox.bottom + fHeight*0.13f - PWL_BEZIER*fHeight*0.055f), PWLPT_BEZIERTO),\r
2234                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f + PWL_BEZIER*fWidth*0.065f, crBBox.bottom + fHeight*0.075f), PWLPT_BEZIERTO),\r
2235                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f, crBBox.bottom + fHeight*0.075f), PWLPT_BEZIERTO),\r
2236                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.505f - PWL_BEZIER*fWidth*0.065f, crBBox.bottom + fHeight*0.075f), PWLPT_BEZIERTO),\r
2237                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.56f, crBBox.bottom + fHeight*0.13f - PWL_BEZIER*fHeight*0.055f), PWLPT_BEZIERTO),\r
2238                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.56f, crBBox.bottom + fHeight*0.13f), PWLPT_BEZIERTO)\r
2239         };\r
2240 \r
2241         if(type == PWLPT_STREAM)\r
2242                 sPathData = GetAppStreamFromArray(PathArray, 59);\r
2243         else\r
2244                 GetPathDataFromArray(path, PathArray, 59);\r
2245 }\r
2246 \r
2247 void CPWL_Utils::GetGraphics_InsertText(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2248 {\r
2249         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2250         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2251 \r
2252         CPWL_PathData PathArray[] = \r
2253         {\r
2254                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10, crBBox.bottom + fHeight/10), PWLPT_MOVETO),\r
2255                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2, crBBox.top - fHeight*2/15), PWLPT_LINETO),\r
2256                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10, crBBox.bottom + fHeight/10), PWLPT_LINETO),\r
2257                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10, crBBox.bottom + fHeight/10), PWLPT_LINETO)\r
2258         };\r
2259 \r
2260         if(type == PWLPT_STREAM)\r
2261                 sPathData = GetAppStreamFromArray(PathArray, 4);\r
2262         else\r
2263                 GetPathDataFromArray(path, PathArray, 4);\r
2264 }\r
2265 \r
2266 void CPWL_Utils::GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2267 {\r
2268         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2269         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2270         FX_FLOAT k = -fHeight/fWidth;\r
2271         CPWL_Point tail;\r
2272         CPWL_Point CicleCenter;\r
2273         tail.x = crBBox.left + fWidth*0.9f;\r
2274         tail.y = k*(tail.x - crBBox.right) + crBBox.bottom;\r
2275         CicleCenter.x = crBBox.left + fWidth*0.15f;\r
2276         CicleCenter.y = k*(CicleCenter.x - crBBox.right) + crBBox.bottom;\r
2277 \r
2278         CPWL_PathData PathArray[] = \r
2279         {\r
2280                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30.0f, -fWidth/30.0f/k + tail.y), PWLPT_MOVETO),\r
2281                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30.0f - fWidth*0.18f, -k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2282                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.18f + fWidth*0.07f,\r
2283                               -fWidth*0.07f/k - k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2284                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.18f - fWidth/20 + fWidth*0.07f,\r
2285                               -fWidth*0.07f/k - k*fWidth/20 - k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2286                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.18f - fWidth/20,\r
2287                               -k*fWidth/20 - k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2288                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.18f - fWidth/20 - fWidth/15,\r
2289                               -k*fWidth/15 - k*fWidth/20 - k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2290                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.18f - fWidth/20 - fWidth/15 + fWidth*0.07f,\r
2291                               -fWidth*0.07f/k - k*fWidth/15 - k*fWidth/20 - k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2292                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.18f - fWidth/20 - fWidth/15 - fWidth/20 + fWidth*0.07f,\r
2293                               -fWidth*0.07f/k + -k*fWidth/20 + -k*fWidth/15 - k*fWidth/20 - k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2294                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.18f - fWidth/20 - fWidth/15 - fWidth/20,\r
2295                               -k*fWidth/20 + -k*fWidth/15 - k*fWidth/20 - k*fWidth*0.18f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2296                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.45f, -k*fWidth*0.45f - fWidth/30/k + tail.y), PWLPT_LINETO),\r
2297                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30 - fWidth*0.45f + fWidth*0.2f,\r
2298                               -fWidth*0.4f/k - k*fWidth*0.45f - fWidth/30/k + tail.y), PWLPT_BEZIERTO),\r
2299                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.2f, - fWidth*0.1f/k + CicleCenter.y), PWLPT_BEZIERTO),\r
2300                 CPWL_PathData(CPWL_Point(CicleCenter.x, CicleCenter.y), PWLPT_BEZIERTO),\r
2301                 CPWL_PathData(CPWL_Point(CicleCenter.x - fWidth/60.0f, -k*fWidth/60 + CicleCenter.y), PWLPT_BEZIERTO),\r
2302                 CPWL_PathData(CPWL_Point(CicleCenter.x - fWidth/60, -k*fWidth/60 + CicleCenter.y), PWLPT_BEZIERTO),\r
2303                 CPWL_PathData(CPWL_Point(CicleCenter.x, CicleCenter.y), PWLPT_BEZIERTO),\r
2304                 CPWL_PathData(CPWL_Point(CicleCenter.x - fWidth*0.22f, fWidth*0.35f/k + CicleCenter.y - fHeight*0.05f), PWLPT_BEZIERTO),\r
2305                 CPWL_PathData(CPWL_Point(tail.x - fWidth/30 - fWidth*0.45f - fWidth*0.18f, fWidth*0.05f/k - k*fWidth*0.45f + fWidth/30/k + tail.y - fHeight*0.05f), PWLPT_BEZIERTO),\r
2306                 CPWL_PathData(CPWL_Point(tail.x - fWidth/30.0f - fWidth*0.45f, -k*fWidth*0.45f + fWidth/30.0f/k + tail.y), PWLPT_BEZIERTO),\r
2307                 CPWL_PathData(CPWL_Point(tail.x - fWidth/30.0f, fWidth/30.0f/k + tail.y), PWLPT_LINETO),\r
2308                 CPWL_PathData(CPWL_Point(tail.x + fWidth/30, -fWidth/30/k + tail.y), PWLPT_LINETO),             \r
2309                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.08f, k*fWidth*0.08f + CicleCenter.y), PWLPT_MOVETO),\r
2310                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.08f + fWidth*0.1f, -fWidth*0.1f/k + k*fWidth*0.08f + CicleCenter.y), PWLPT_BEZIERTO),\r
2311                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.22f + fWidth*0.1f, k*fWidth*0.22f + CicleCenter.y - fWidth*0.1f/k), PWLPT_BEZIERTO),\r
2312                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.22f, k*fWidth*0.22f + CicleCenter.y), PWLPT_BEZIERTO),\r
2313                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.22f - fWidth*0.1f, fWidth*0.1f/k + k*fWidth*0.22f + CicleCenter.y), PWLPT_BEZIERTO),\r
2314                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.08f - fWidth*0.1f, fWidth*0.1f/k + k*fWidth*0.08f + CicleCenter.y), PWLPT_BEZIERTO),\r
2315                 CPWL_PathData(CPWL_Point(CicleCenter.x + fWidth*0.08f, k*fWidth*0.08f + CicleCenter.y), PWLPT_BEZIERTO)\r
2316         };\r
2317 \r
2318         if(type == PWLPT_STREAM)\r
2319                 sPathData = GetAppStreamFromArray(PathArray, 28);\r
2320         else\r
2321                 GetPathDataFromArray(path, PathArray, 28);\r
2322 }\r
2323 \r
2324 void CPWL_Utils::GetGraphics_NewParagraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2325 {\r
2326         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2327         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2328 \r
2329         CPWL_PathData PathArray[] = \r
2330         {\r
2331                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/20.0f), PWLPT_MOVETO),\r
2332                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10.0f, crBBox.top - fHeight/2.0f), PWLPT_LINETO),\r
2333                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10.0f, crBBox.top - fHeight/2.0f), PWLPT_LINETO),\r
2334                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/20.0f), PWLPT_LINETO),\r
2335                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.12f, crBBox.top - fHeight*17/30.0f), PWLPT_MOVETO),\r
2336                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.12f, crBBox.bottom + fHeight/10.0f), PWLPT_LINETO),\r
2337                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.22f, crBBox.bottom + fHeight/10.0f), PWLPT_LINETO),\r
2338                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.22f, crBBox.top - fHeight*17/30.0f - fWidth*0.14f), PWLPT_LINETO),\r
2339                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.38f, crBBox.bottom + fHeight/10.0f), PWLPT_LINETO),\r
2340                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.48f, crBBox.bottom + fHeight/10.0f), PWLPT_LINETO),\r
2341                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.48f, crBBox.top - fHeight*17/30.0f), PWLPT_LINETO),\r
2342                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.38f, crBBox.top - fHeight*17/30.0f), PWLPT_LINETO),\r
2343                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.38f, crBBox.bottom + fWidth*0.24f), PWLPT_LINETO),\r
2344                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.22f, crBBox.top - fHeight*17/30.0f), PWLPT_LINETO),\r
2345                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.12f, crBBox.top - fHeight*17/30.0f), PWLPT_LINETO),\r
2346                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.bottom + fHeight/10.0f), PWLPT_MOVETO),\r
2347                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.bottom + fHeight/10.0f), PWLPT_LINETO),\r
2348                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.bottom + fHeight/10.0f + fHeight/7.0f), PWLPT_LINETO),\r
2349                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.97f, crBBox.bottom + fHeight/10.0f + fHeight/7.0f), PWLPT_BEZIERTO),\r
2350                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.97f, crBBox.top - fHeight*17/30.0f), PWLPT_BEZIERTO),\r
2351                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.top - fHeight*17/30.0f), PWLPT_BEZIERTO),\r
2352                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fHeight*17/30.0f), PWLPT_LINETO),\r
2353                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.bottom + fHeight/10.0f), PWLPT_LINETO),\r
2354                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.bottom + fHeight/7 + fHeight*0.18f), PWLPT_MOVETO),\r
2355                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.85f, crBBox.bottom + fHeight/7 + fHeight*0.18f), PWLPT_BEZIERTO),\r
2356                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.85f, crBBox.top - fHeight*17/30.0f - fHeight*0.08f), PWLPT_BEZIERTO),\r
2357                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.top - fHeight*17/30.0f - fHeight*0.08f), PWLPT_BEZIERTO),\r
2358                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.bottom + fHeight/7 + fHeight*0.18f), PWLPT_LINETO)\r
2359         };\r
2360 \r
2361         if(type == PWLPT_STREAM)\r
2362                 sPathData = GetAppStreamFromArray(PathArray, 28);\r
2363         else\r
2364                 GetPathDataFromArray(path, PathArray, 28);\r
2365 }\r
2366 \r
2367 void CPWL_Utils::GetGraphics_TextNote(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2368 {\r
2369         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2370         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2371 \r
2372         CPWL_PathData PathArray[] = \r
2373         {\r
2374                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/10.0f, crBBox.bottom + fHeight/15.0f), PWLPT_MOVETO),\r
2375                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*7/10.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO),\r
2376                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO),\r
2377                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10.0f, crBBox.top - fHeight/15.0f), PWLPT_LINETO),\r
2378                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10.0f, crBBox.top - fHeight/15.0f), PWLPT_LINETO),\r
2379                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10.0f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2380                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/10.0f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2381                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO),\r
2382                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/10.0f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2383                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/10.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO),\r
2384                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10.0f, crBBox.bottom + fHeight*4/15.0f), PWLPT_LINETO),\r
2385                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/5.0f, crBBox.top - fHeight*4/15.0f), PWLPT_MOVETO),\r
2386                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/5.0f, crBBox.top - fHeight*4/15.0f), PWLPT_LINETO),\r
2387                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/5.0f, crBBox.top - fHeight*7/15.0f), PWLPT_MOVETO),\r
2388                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/5.0f, crBBox.top - fHeight*7/15.0f), PWLPT_LINETO),\r
2389                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/5.0f, crBBox.top - fHeight*10/15.0f), PWLPT_MOVETO),\r
2390                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*3/10.0f, crBBox.top - fHeight*10/15.0f), PWLPT_LINETO)\r
2391         };\r
2392 \r
2393         if(type == PWLPT_STREAM)\r
2394                 sPathData = GetAppStreamFromArray(PathArray, 17);\r
2395         else\r
2396                 GetPathDataFromArray(path, PathArray, 17);\r
2397 }\r
2398 \r
2399 void CPWL_Utils::GetGraphics_Paragraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2400 {\r
2401         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2402         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2403 \r
2404         CPWL_PathData PathArray[] =\r
2405         {\r
2406                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/15.0f), PWLPT_MOVETO),\r
2407                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.top - fHeight/15.0f), PWLPT_LINETO),\r
2408                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2409                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.634f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2410                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.634f, crBBox.top - fHeight*2/15.0f), PWLPT_LINETO),\r
2411                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.566f, crBBox.top - fHeight*2/15.0f), PWLPT_LINETO),\r
2412                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.566f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2413                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2414                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/15.0f - fHeight*0.4f), PWLPT_LINETO),\r
2415                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.2f, crBBox.top - fHeight/15.0f - fHeight*0.4f), PWLPT_BEZIERTO),\r
2416                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.2f, crBBox.top - fHeight/15.0f), PWLPT_BEZIERTO),\r
2417                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/15.0f), PWLPT_BEZIERTO)\r
2418         };\r
2419 \r
2420         if(type == PWLPT_STREAM)\r
2421                 sPathData = GetAppStreamFromArray(PathArray, 12);\r
2422         else\r
2423                 GetPathDataFromArray(path, PathArray, 12);\r
2424 }\r
2425 \r
2426 void CPWL_Utils::GetGraphics_RightArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2427 {\r
2428         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2429         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2430 \r
2431         CPWL_PathData PathArray[] = \r
2432         {\r
2433                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.top - fHeight/2.0f), PWLPT_MOVETO),\r
2434                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + fWidth/8.0f, crBBox.bottom + fHeight/5.0f), PWLPT_LINETO),\r
2435                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.bottom + fHeight/5.0f), PWLPT_LINETO),\r
2436                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f - fWidth*0.15f, crBBox.top - fHeight/2.0f - fWidth/25.0f), PWLPT_LINETO),\r
2437                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.1f, crBBox.top - fHeight/2.0f - fWidth/25.0f), PWLPT_LINETO),\r
2438                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.1f, crBBox.top - fHeight/2.0f + fWidth/25.0f), PWLPT_LINETO),\r
2439                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f - fWidth*0.15f, crBBox.top - fHeight/2.0f + fWidth/25.0f), PWLPT_LINETO),\r
2440                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/5.0f), PWLPT_LINETO),\r
2441                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f + fWidth/8.0f, crBBox.top - fHeight/5.0f), PWLPT_LINETO),\r
2442                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15.0f, crBBox.top - fHeight/2.0f), PWLPT_LINETO)\r
2443         };\r
2444 \r
2445         if(type == PWLPT_STREAM)\r
2446                 sPathData = GetAppStreamFromArray(PathArray, 10);\r
2447         else\r
2448                 GetPathDataFromArray(path, PathArray, 10);\r
2449 }\r
2450 \r
2451 void CPWL_Utils::GetGraphics_RightPointer(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2452 {\r
2453         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2454         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2455 \r
2456         CPWL_PathData PathArray[] = \r
2457         {\r
2458                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30.0f, crBBox.top - fHeight/2.0f), PWLPT_MOVETO),\r
2459                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/30.0f, crBBox.bottom + fHeight/6.0f), PWLPT_LINETO),\r
2460                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*4/15.0f, crBBox.top - fHeight/2.0f), PWLPT_LINETO),\r
2461                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/30.0f, crBBox.top - fHeight/6.0f), PWLPT_LINETO),\r
2462                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30.0f, crBBox.top - fHeight/2.0f), PWLPT_LINETO)\r
2463         };\r
2464 \r
2465         if(type == PWLPT_STREAM)\r
2466                 sPathData = GetAppStreamFromArray(PathArray, 5);\r
2467         else\r
2468                 GetPathDataFromArray(path, PathArray, 5);\r
2469 }\r
2470 \r
2471 void CPWL_Utils::GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2472 {\r
2473         FX_FLOAT fLongRadius = (crBBox.top - crBBox.bottom)/(1+(FX_FLOAT)cos(PWL_PI/5.0f));\r
2474         fLongRadius = fLongRadius * 0.7f;\r
2475         FX_FLOAT fShortRadius = fLongRadius * 0.55f;\r
2476         CPDF_Point ptCenter = CPDF_Point((crBBox.left + crBBox.right) / 2.0f,(crBBox.top + crBBox.bottom) / 2.0f);\r
2477         \r
2478         FX_FLOAT px1[5], py1[5];\r
2479         FX_FLOAT px2[5], py2[5];\r
2480 \r
2481         FX_FLOAT fAngel = PWL_PI/10.0f;\r
2482 \r
2483         for (FX_INT32 i=0; i<5; i++)\r
2484         {\r
2485                 px1[i] = ptCenter.x + fLongRadius * (FX_FLOAT)cos(fAngel);\r
2486                 py1[i] = ptCenter.y + fLongRadius * (FX_FLOAT)sin(fAngel);\r
2487 \r
2488                 fAngel += PWL_PI * 2 / 5.0f;\r
2489         }\r
2490 \r
2491         fAngel = PWL_PI/5.0f + PWL_PI/10.0f;\r
2492 \r
2493         for (FX_INT32 j=0; j<5; j++)\r
2494         {\r
2495                 px2[j] = ptCenter.x + fShortRadius * (FX_FLOAT)cos(fAngel);\r
2496                 py2[j] = ptCenter.y + fShortRadius * (FX_FLOAT)sin(fAngel);\r
2497 \r
2498                 fAngel += PWL_PI * 2 / 5.0f;\r
2499         }\r
2500 \r
2501         CPWL_PathData PathArray[11];\r
2502         PathArray[0] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_MOVETO);\r
2503         PathArray[1] = CPWL_PathData(CPWL_Point(px2[0], py2[0]), PWLPT_LINETO);\r
2504 \r
2505         for(FX_INT32 k = 0; k < 4; k++)\r
2506         {\r
2507                 PathArray[(k+1)*2] = CPWL_PathData(CPWL_Point(px1[k+1], py1[k+1]), PWLPT_LINETO);\r
2508                 PathArray[(k+1)*2 + 1] = CPWL_PathData(CPWL_Point(px2[k+1], py2[k+1]), PWLPT_LINETO);\r
2509         }\r
2510 \r
2511         PathArray[10] = CPWL_PathData(CPWL_Point(px1[0], py1[0]), PWLPT_LINETO);\r
2512 \r
2513         if(type == PWLPT_STREAM)\r
2514                 sPathData = GetAppStreamFromArray(PathArray, 11);\r
2515         else\r
2516                 GetPathDataFromArray(path, PathArray, 11);\r
2517 }\r
2518 \r
2519 void CPWL_Utils::GetGraphics_UpArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2520 {\r
2521         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2522         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2523 \r
2524         CPWL_PathData PathArray[] = \r
2525         {\r
2526                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/15.0f), PWLPT_MOVETO),\r
2527                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/10.0f, crBBox.top - fWidth*3/5.0f), PWLPT_LINETO),\r
2528                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fWidth*3/5.0f), PWLPT_LINETO),\r
2529                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2530                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.bottom + fHeight/15.0f), PWLPT_LINETO),\r
2531                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fWidth*3/5.0f), PWLPT_LINETO),\r
2532                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/10, crBBox.top - fWidth*3/5.0f), PWLPT_LINETO),\r
2533                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/2.0f, crBBox.top - fHeight/15.0f), PWLPT_LINETO)\r
2534         };\r
2535 \r
2536         if(type == PWLPT_STREAM)\r
2537                 sPathData = GetAppStreamFromArray(PathArray, 8);\r
2538         else\r
2539                 GetPathDataFromArray(path, PathArray, 8);\r
2540 }\r
2541 \r
2542 void CPWL_Utils::GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2543 {\r
2544         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2545         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2546         CPWL_Point leftup(crBBox.left, crBBox.top);\r
2547         CPWL_Point rightdown(crBBox.right, crBBox.bottom);\r
2548         FX_FLOAT k = -fHeight/fWidth;\r
2549         CPWL_Point tail;\r
2550         tail.x = crBBox.left + fWidth*4/5.0f;\r
2551         tail.y = k*(tail.x - crBBox.right) + rightdown.y;\r
2552 \r
2553         CPWL_PathData PathArray[] = \r
2554         {\r
2555                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/20.0f, k*(crBBox.left + fWidth/20.0f - rightdown.x) + rightdown.y), PWLPT_MOVETO),\r
2556                 CPWL_PathData(CPWL_Point(fHeight*17/60.0f/k + tail.x + fWidth/10.0f + fWidth/5.0f,\r
2557                               -fWidth/5.0f/k + tail.y - fWidth/10.0f/k + fHeight*17/60.0f), PWLPT_LINETO),\r
2558                 CPWL_PathData(CPWL_Point(fHeight*17/60.0f/k + tail.x + fWidth/10.0f,\r
2559                               tail.y - fWidth/10.0f/k + fHeight*17/60.0f), PWLPT_LINETO),\r
2560                 CPWL_PathData(CPWL_Point(tail.x + fWidth/10.0f, tail.y - fWidth/10.0f/k), PWLPT_LINETO),\r
2561                 CPWL_PathData(CPWL_Point(tail.x - fWidth/10.0f, tail.y + fWidth/10.0f/k), PWLPT_LINETO),\r
2562                 CPWL_PathData(CPWL_Point(fHeight*17/60.0f/k + tail.x - fWidth/10.0f, tail.y + fWidth/10.0f/k + fHeight*17/60.0f), PWLPT_LINETO),\r
2563                 CPWL_PathData(CPWL_Point(fHeight*17/60.0f/k + tail.x - fWidth/10.0f - fWidth/5.0f,\r
2564                               fWidth/5.0f/k + tail.y + fWidth/10.0f/k + fHeight*17/60.0f), PWLPT_LINETO),\r
2565                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/20.0f, k*(crBBox.left + fWidth/20.0f - rightdown.x) + rightdown.y), PWLPT_LINETO)\r
2566         };\r
2567 \r
2568         if(type == PWLPT_STREAM)\r
2569                 sPathData = GetAppStreamFromArray(PathArray, 8);\r
2570         else\r
2571                 GetPathDataFromArray(path, PathArray, 8);\r
2572 }\r
2573 \r
2574 void CPWL_Utils::GetGraphics_Graph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2575 {\r
2576         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2577         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2578 \r
2579         CPWL_PathData PathArray[] = \r
2580         {\r
2581                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.05f, crBBox.top - fWidth*0.15f), PWLPT_MOVETO),\r
2582                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.25f, crBBox.top - fHeight*0.15f), PWLPT_LINETO),\r
2583                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.275f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2584                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.05f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2585                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.05f, crBBox.top - fWidth*0.15f), PWLPT_LINETO),\r
2586 \r
2587                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.275f, crBBox.top - fWidth*0.45f), PWLPT_MOVETO),\r
2588                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.475f, crBBox.top - fWidth*0.45f), PWLPT_LINETO),\r
2589                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.475f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2590                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.275f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2591                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.275f, crBBox.top - fWidth*0.45f), PWLPT_LINETO),\r
2592 \r
2593                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.top - fHeight*0.05f), PWLPT_MOVETO),\r
2594                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.top - fHeight*0.05f), PWLPT_LINETO),\r
2595                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.7f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2596                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2597                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.top - fHeight*0.05f), PWLPT_LINETO),\r
2598 \r
2599                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.725f, crBBox.top - fWidth*0.35f), PWLPT_MOVETO),\r
2600                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.925f, crBBox.top - fWidth*0.35f), PWLPT_LINETO),\r
2601                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.925f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2602                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.725f, crBBox.bottom + fHeight*0.08f), PWLPT_LINETO),\r
2603                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.725f, crBBox.top - fWidth*0.35f), PWLPT_LINETO)\r
2604         };\r
2605 \r
2606         if(type == PWLPT_STREAM)\r
2607                 sPathData = GetAppStreamFromArray(PathArray, 20);\r
2608         else\r
2609                 GetPathDataFromArray(path, PathArray, 20);\r
2610 }\r
2611 \r
2612 void CPWL_Utils::GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2613 {\r
2614         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2615         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2616 \r
2617         CPWL_PathData PathArray[] = \r
2618         {\r
2619                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60, crBBox.top - fHeight*0.25f), PWLPT_MOVETO),\r
2620                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60, crBBox.bottom + fHeight*0.25f), PWLPT_LINETO),\r
2621                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60, crBBox.bottom + fHeight*0.25f - fWidth*57/60.0f*0.35f), PWLPT_BEZIERTO),\r
2622                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30, crBBox.bottom + fHeight*0.25f - fWidth*57/60.0f*0.35f), PWLPT_BEZIERTO),\r
2623                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30, crBBox.bottom + fHeight*0.25f), PWLPT_BEZIERTO),\r
2624 \r
2625                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30, crBBox.top - fHeight*0.33f), PWLPT_LINETO),\r
2626                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30, crBBox.top - fHeight*0.33f + fHeight/15*0.5f), PWLPT_BEZIERTO),\r
2627                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.top - fHeight*0.33f + fHeight/15*0.5f), PWLPT_BEZIERTO),\r
2628                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.top - fHeight*0.33f), PWLPT_BEZIERTO),\r
2629         \r
2630                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.bottom + fHeight*0.2f), PWLPT_LINETO),\r
2631                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/30 - fWidth*0.12f, crBBox.bottom + fHeight*0.2f - (fWidth*57/60.0f - fWidth*0.24f)*0.25f), PWLPT_BEZIERTO),\r
2632                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60 + fWidth*0.12f, crBBox.bottom + fHeight*0.2f - (fWidth*57/60.0f - fWidth*0.24f)*0.25f), PWLPT_BEZIERTO),\r
2633                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60 + fWidth*0.12f, crBBox.bottom + fHeight*0.2f), PWLPT_BEZIERTO),\r
2634 \r
2635                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60 + fWidth*0.12f, crBBox.top - fHeight*0.2f), PWLPT_LINETO),\r
2636                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60 + fWidth*0.12f, crBBox.top - fHeight*0.2f + (fWidth*11/12.0f - fWidth*0.36f)*0.25f), PWLPT_BEZIERTO),\r
2637                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.24f, crBBox.top - fHeight*0.2f + (fWidth*11/12.0f - fWidth*0.36f)*0.25f), PWLPT_BEZIERTO),\r
2638                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.24f, crBBox.top - fHeight*0.2f), PWLPT_BEZIERTO),\r
2639 \r
2640                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.24f, crBBox.bottom + fHeight*0.25f), PWLPT_LINETO),\r
2641                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.24f, crBBox.bottom + fHeight*0.25f - (fWidth*14/15.0f - fWidth*0.53f)*0.25f), PWLPT_BEZIERTO),\r
2642                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.29f, crBBox.bottom + fHeight*0.25f - (fWidth*14/15.0f - fWidth*0.53f)*0.25f), PWLPT_BEZIERTO),\r
2643                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.29f, crBBox.bottom + fHeight*0.25f), PWLPT_BEZIERTO),\r
2644 \r
2645                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.29f, crBBox.top - fHeight*0.33f), PWLPT_LINETO),\r
2646                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.29f, crBBox.top - fHeight*0.33f + fWidth*0.12f*0.35f), PWLPT_BEZIERTO),\r
2647                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.17f, crBBox.top - fHeight*0.33f + fWidth*0.12f*0.35f), PWLPT_BEZIERTO),\r
2648                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.17f, crBBox.top - fHeight*0.33f), PWLPT_BEZIERTO),\r
2649 \r
2650                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.17f, crBBox.bottom + fHeight*0.3f), PWLPT_LINETO),\r
2651                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.17f, crBBox.bottom + fHeight*0.3f - fWidth*(14/15.0f - 0.29f)*0.35f), PWLPT_BEZIERTO),\r
2652                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.12f, crBBox.bottom + fHeight*0.3f - fWidth*(14/15.0f - 0.29f)*0.35f), PWLPT_BEZIERTO),\r
2653                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.12f, crBBox.bottom + fHeight*0.3f), PWLPT_BEZIERTO),\r
2654 \r
2655                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.12f, crBBox.top - fHeight*0.25f), PWLPT_LINETO),\r
2656                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth/15 - fWidth*0.12f, crBBox.top - fHeight*0.25f + fWidth*0.35f*(11/12.0f - 0.12f)), PWLPT_BEZIERTO),\r
2657                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60, crBBox.top - fHeight*0.25f + fWidth*0.35f*(11/12.0f - 0.12f)), PWLPT_BEZIERTO),\r
2658                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth/60, crBBox.top - fHeight*0.25f), PWLPT_BEZIERTO)\r
2659         };\r
2660 \r
2661         if(type == PWLPT_STREAM)\r
2662                 sPathData = GetAppStreamFromArray(PathArray, 33);\r
2663         else\r
2664                 GetPathDataFromArray(path, PathArray, 33);      \r
2665 }\r
2666 \r
2667 void CPWL_Utils::GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2668 {\r
2669         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2670         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2671 \r
2672         CPWL_PathData PathArray[] = \r
2673         {\r
2674                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.25f, crBBox.top - fHeight*0.1f), PWLPT_MOVETO),\r
2675                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.23f), PWLPT_LINETO),\r
2676                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.5f), PWLPT_LINETO),\r
2677                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.5f + fWidth*0.04f), PWLPT_BEZIERTO),\r
2678                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fHeight*0.5f + fWidth*0.04f), PWLPT_BEZIERTO),\r
2679                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fHeight*0.5f), PWLPT_BEZIERTO),\r
2680 \r
2681                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fHeight*0.23f), PWLPT_LINETO),\r
2682                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.25f, crBBox.top - fHeight*0.1f), PWLPT_LINETO),\r
2683                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.25f, crBBox.top - fHeight*0.1f), PWLPT_LINETO),\r
2684                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.23f), PWLPT_LINETO),\r
2685                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fHeight*0.23f), PWLPT_LINETO),\r
2686 \r
2687                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.5f), PWLPT_MOVETO),\r
2688                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f - fWidth*0.25f*0.4f, crBBox.top - fHeight*0.5f), PWLPT_BEZIERTO),\r
2689                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.15f, crBBox.top - fHeight*0.65f + fHeight*0.15f*0.4f), PWLPT_BEZIERTO),\r
2690                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.15f, crBBox.top - fHeight*0.65f), PWLPT_BEZIERTO),\r
2691 \r
2692                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.15f, crBBox.top - fHeight*0.65f), PWLPT_LINETO),\r
2693                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.15f, crBBox.top - fHeight*0.65f + fHeight*0.15f*0.4f), PWLPT_BEZIERTO),\r
2694                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f + fWidth*0.25f*0.4f, crBBox.top - fHeight*0.5f), PWLPT_BEZIERTO),\r
2695                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fHeight*0.5f), PWLPT_BEZIERTO),\r
2696 \r
2697                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.6f, crBBox.top - fHeight*0.5f + fWidth*0.04f), PWLPT_BEZIERTO),\r
2698                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.5f + fWidth*0.04f), PWLPT_BEZIERTO),\r
2699                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.5f), PWLPT_BEZIERTO),\r
2700 \r
2701                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.top - fHeight*0.65f), PWLPT_MOVETO),\r
2702                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.5f, crBBox.bottom + fHeight*0.1f), PWLPT_LINETO)\r
2703         };\r
2704 \r
2705         if(type == PWLPT_STREAM)\r
2706                 sPathData = GetAppStreamFromArray(PathArray, 24);\r
2707         else\r
2708                 GetPathDataFromArray(path, PathArray, 24);\r
2709 }\r
2710 \r
2711 void CPWL_Utils::GetGraphics_Tag(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2712 {\r
2713         FX_FLOAT fWidth = crBBox.right - crBBox.left;\r
2714         FX_FLOAT fHeight = crBBox.top - crBBox.bottom;\r
2715 \r
2716         CPWL_PathData PathArray[] = \r
2717         {\r
2718                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.1f), PWLPT_MOVETO),\r
2719                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.1f, crBBox.top - fHeight*0.5f), PWLPT_LINETO),\r
2720                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.3f, crBBox.bottom + fHeight*0.1f), PWLPT_LINETO),\r
2721                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.1f, crBBox.bottom + fHeight*0.1f), PWLPT_LINETO),\r
2722                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.1f, crBBox.top - fHeight*0.1f), PWLPT_LINETO),\r
2723                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.1f), PWLPT_LINETO),\r
2724                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.3f), PWLPT_MOVETO),\r
2725                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.2f, crBBox.top - fHeight*0.3f), PWLPT_LINETO),\r
2726                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.5f), PWLPT_MOVETO),\r
2727                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.2f, crBBox.top - fHeight*0.5f), PWLPT_LINETO),\r
2728                 CPWL_PathData(CPWL_Point(crBBox.left + fWidth*0.4f, crBBox.top - fHeight*0.7f), PWLPT_MOVETO),\r
2729                 CPWL_PathData(CPWL_Point(crBBox.right - fWidth*0.2f, crBBox.top - fHeight*0.7f), PWLPT_LINETO)\r
2730         };\r
2731 \r
2732         if(type == PWLPT_STREAM)\r
2733                 sPathData = GetAppStreamFromArray(PathArray, 12);\r
2734         else\r
2735                 GetPathDataFromArray(path, PathArray, 12);\r
2736 }\r
2737 \r
2738 void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type)\r
2739 {\r
2740         FX_FLOAT fOutWidth = crBBox.right - crBBox.left;\r
2741         FX_FLOAT fOutHeight = crBBox.top - crBBox.bottom;\r
2742 \r
2743         CPDF_Rect crInBox = crBBox;\r
2744         crInBox.left = crBBox.left + fOutWidth*0.08f;\r
2745         crInBox.right = crBBox.right - fOutWidth*0.08f;\r
2746         crInBox.top = crBBox.top - fOutHeight*0.08f;\r
2747         crInBox.bottom = crBBox.bottom + fOutHeight*0.08f;\r
2748 \r
2749         FX_FLOAT fWidth = crInBox.right - crInBox.left;\r
2750         FX_FLOAT fHeight = crInBox.top - crInBox.bottom;\r
2751 \r
2752         CPWL_PathData PathArray[] = \r
2753         {\r
2754                 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top), PWLPT_MOVETO),\r
2755                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.45f, crInBox.top), PWLPT_LINETO),\r
2756                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.45f, crInBox.top - PWL_BEZIER * fHeight * 0.4f), PWLPT_BEZIERTO),\r
2757                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.45f  - PWL_BEZIER * fWidth * 0.45f, crInBox.top - fHeight*0.4f), PWLPT_BEZIERTO),\r
2758                 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight*0.4f), PWLPT_BEZIERTO),\r
2759                 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top), PWLPT_LINETO),\r
2760 \r
2761                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.60f, crInBox.top), PWLPT_MOVETO),\r
2762                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.75f, crInBox.top), PWLPT_LINETO),\r
2763                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.75f, crInBox.top - PWL_BEZIER * fHeight * 0.7f), PWLPT_BEZIERTO),\r
2764                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.75f  - PWL_BEZIER * fWidth * 0.75f, crInBox.top - fHeight*0.7f), PWLPT_BEZIERTO),\r
2765                 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight*0.7f), PWLPT_BEZIERTO),\r
2766                 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight*0.55f), PWLPT_LINETO),\r
2767                 CPWL_PathData(CPWL_Point(crInBox.left + PWL_BEZIER * fWidth*0.60f, crInBox.top - fHeight*0.55f), PWLPT_BEZIERTO),\r
2768                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.60f, crInBox.top - PWL_BEZIER * fHeight * 0.55f), PWLPT_BEZIERTO),\r
2769                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth * 0.60f, crInBox.top), PWLPT_BEZIERTO),\r
2770 \r
2771                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.90f, crInBox.top), PWLPT_MOVETO),\r
2772                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.90f, crInBox.top - PWL_BEZIER * fHeight * 0.85f), PWLPT_BEZIERTO),\r
2773                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.90f  - PWL_BEZIER * fWidth * 0.90f, crInBox.top - fHeight*0.85f), PWLPT_BEZIERTO),\r
2774                 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.top - fHeight*0.85f), PWLPT_BEZIERTO),\r
2775                 CPWL_PathData(CPWL_Point(crInBox.left, crInBox.bottom), PWLPT_LINETO),\r
2776                 CPWL_PathData(CPWL_Point(crInBox.right, crInBox.bottom), PWLPT_LINETO),\r
2777                 CPWL_PathData(CPWL_Point(crInBox.right, crInBox.top), PWLPT_LINETO),\r
2778                 CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.90f, crInBox.top), PWLPT_LINETO),\r
2779 \r
2780                 /*\r
2781                 CPWL_PathData(CPWL_Point(crBBox.left, crBBox.top), PWLPT_MOVETO),\r
2782                 CPWL_PathData(CPWL_Point(crBBox.right, crBBox.top), PWLPT_LINETO),\r
2783                 CPWL_PathData(CPWL_Point(crBBox.right, crBBox.bottom), PWLPT_LINETO),\r
2784                 CPWL_PathData(CPWL_Point(crBBox.left, crBBox.bottom), PWLPT_LINETO),\r
2785                 CPWL_PathData(CPWL_Point(crBBox.left, crBBox.top), PWLPT_LINETO),\r
2786 \r
2787                 CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_MOVETO),\r
2788                 CPWL_PathData(CPWL_Point(crBBox.right-fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_LINETO),\r
2789                 CPWL_PathData(CPWL_Point(crBBox.right-fOutWidth*0.04f, crBBox.bottom+fOutHeight*0.04f), PWLPT_LINETO),\r
2790                 CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.bottom+fOutHeight*0.04f), PWLPT_LINETO),\r
2791                 CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_LINETO),\r
2792                 */\r
2793         };\r
2794 \r
2795         if(type == PWLPT_STREAM)\r
2796                 sPathData = GetAppStreamFromArray(PathArray, 23);\r
2797         else\r
2798                 GetPathDataFromArray(path, PathArray, 23);\r
2799 }\r
2800 \r
2801 void CPWL_Color::ConvertColorType(FX_INT32 nColorType)\r
2802 {\r
2803         switch (this->nColorType)\r
2804         {\r
2805         case COLORTYPE_TRANSPARENT:\r
2806                 break;\r
2807         case COLORTYPE_GRAY:\r
2808                 switch (nColorType)\r
2809                 {\r
2810                 case COLORTYPE_RGB:\r
2811                         CPWL_Utils::ConvertGRAY2RGB(this->fColor1, this->fColor1, this->fColor2, this->fColor3);\r
2812                         break;\r
2813                 case COLORTYPE_CMYK:\r
2814                         CPWL_Utils::ConvertGRAY2CMYK(this->fColor1, this->fColor1, this->fColor2, this->fColor3, this->fColor4);\r
2815                         break;\r
2816                 }\r
2817                 break;\r
2818         case COLORTYPE_RGB:\r
2819                 switch (nColorType)\r
2820                 {\r
2821                 case COLORTYPE_GRAY:\r
2822                         CPWL_Utils::ConvertRGB2GRAY(this->fColor1, this->fColor2, this->fColor3, this->fColor1);\r
2823                         break;\r
2824                 case COLORTYPE_CMYK:\r
2825                         CPWL_Utils::ConvertRGB2CMYK(this->fColor1, this->fColor2, this->fColor3, this->fColor1, this->fColor2, this->fColor3, this->fColor4);\r
2826                         break;\r
2827                 }\r
2828                 break;\r
2829         case COLORTYPE_CMYK:\r
2830                 switch (nColorType)\r
2831                 {\r
2832                 case COLORTYPE_GRAY:\r
2833                         CPWL_Utils::ConvertCMYK2GRAY(this->fColor1, this->fColor2, this->fColor3, this->fColor4, this->fColor1);\r
2834                         break;\r
2835                 case COLORTYPE_RGB:\r
2836                         CPWL_Utils::ConvertCMYK2RGB(this->fColor1, this->fColor2, this->fColor3, this->fColor4, this->fColor1, this->fColor2, this->fColor3);\r
2837                         break;\r
2838                 }\r
2839                 break;\r
2840         }\r
2841         this->nColorType = nColorType;\r
2842 }\r
2843 \r
2844 \r