source: trunk/src/comdlg32/comdlg32.cpp@ 181

Last change on this file since 181 was 181, checked in by achimha, 26 years ago

More unicode fixes - not complete yet..

File size: 23.6 KB
Line 
1/* $Id: comdlg32.cpp,v 1.6 1999-06-24 16:54:24 achimha Exp $ */
2
3/*
4 * COMDLG32 implementation
5 *
6 * Copyright 1998 Sander van Leeuwen
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#include <os2win.h>
13#include <stdarg.h>
14#include <stdlib.h>
15#include <string.h>
16#include <misc.h>
17#include <wndproc.h>
18
19
20#define COMDLG32_CHECKHOOK(a,b,c) \
21 if(a->Flags & b) \
22 { \
23 wndproc = CreateWindowProc((WNDPROC)a->lpfnHook);\
24 if(wndproc == NULL) \
25 return(FALSE); \
26 \
27 a->lpfnHook = (c)Win32WindowProc::GetOS2Callback();\
28 }
29
30#define COMDLG32_CHECKHOOK2(a,b,c,d) \
31 if(a->Flags & b) \
32 { \
33 wndproc = CreateWindowProc((WNDPROC)a->d);\
34 if(wndproc == NULL) \
35 return(FALSE); \
36 \
37 a->d = (c)Win32WindowProc::GetOS2Callback();\
38 }
39
40
41/*****************************************************************************
42 * Name :
43 * Purpose :
44 * Parameters:
45 * Variables :
46 * Result :
47 * Remark :
48 * Status :
49 *
50 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
51 *****************************************************************************/
52
53BOOL WIN32API GetSaveFileNameA(LPOPENFILENAMEA lpofn)
54{
55 Win32WindowProc *wndproc;
56
57 dprintf(("COMDLG32: GetSaveFileNameA(%08xh)\n",
58 lpofn));
59
60 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
61
62 return(O32_GetSaveFileName(lpofn));
63}
64
65
66/*****************************************************************************
67 * Name :
68 * Purpose :
69 * Parameters:
70 * Variables :
71 * Result :
72 * Remark :
73 * Status :
74 *
75 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
76 *****************************************************************************/
77
78BOOL WIN32API GetOpenFileNameA(LPOPENFILENAMEA lpofn)
79{
80 Win32WindowProc *wndproc;
81
82 dprintf(("COMDLG32: GetOpenFileNameA(%08xh)\n",
83 lpofn));
84
85 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
86
87 return(O32_GetOpenFileName(lpofn));
88}
89
90
91/*****************************************************************************
92 * Name :
93 * Purpose :
94 * Parameters:
95 * Variables :
96 * Result :
97 * Remark :
98 * Status :
99 *
100 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
101 *****************************************************************************/
102
103INT16 WIN32API GetFileTitleA(LPCSTR lpFile,
104 LPSTR lpTitle,
105 UINT cbBuf)
106{
107 dprintf(("COMDLG32: GetFileTitleA(%s,%08xh,%08xh)\n",
108 lpFile,
109 lpTitle,
110 cbBuf));
111
112 return O32_GetFileTitle(lpFile,
113 lpTitle,
114 cbBuf);
115}
116
117
118/*****************************************************************************
119 * Name :
120 * Purpose :
121 * Parameters:
122 * Variables :
123 * Result :
124 * Remark :
125 * Status :
126 *
127 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
128 *****************************************************************************/
129
130BOOL WIN32API ChooseColorA(LPCHOOSECOLORA lpcc)
131{
132 Win32WindowProc *wndproc;
133
134 dprintf(("COMDLG32: ChooseColorA(%08xh)\n",
135 lpcc));
136
137 COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)
138
139 return O32_ChooseColor(lpcc);
140}
141
142
143/*****************************************************************************
144 * Name :
145 * Purpose :
146 * Parameters:
147 * Variables :
148 * Result :
149 * Remark : casting is a little hot, should work however
150 * assuming lpcc->lpTemplateName is READONLY pointer!
151 * Status :
152 *
153 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
154 *****************************************************************************/
155
156BOOL WIN32API ChooseColorW(LPCHOOSECOLORW lpcc)
157{
158 Win32WindowProc *wndproc;
159 BOOL bResult;
160 LPCWSTR lpTemplateNameBackup = lpcc->lpTemplateName;
161
162 dprintf(("COMDLG32: ChooseColorW(%08xh).\n",
163 lpcc));
164
165 // if no template is to convert, we can take this shortcut
166 if (!(lpcc->Flags & CC_ENABLETEMPLATE))
167 return O32_ChooseColor( (LPCHOOSECOLORA)lpcc );
168
169
170 // convert to ASCII string
171 if (lpcc->lpTemplateName != NULL)
172 lpcc->lpTemplateName = (LPCWSTR)UnicodeToAsciiString((WCHAR*)lpcc->lpTemplateName);
173
174 COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)
175
176 bResult = O32_ChooseColor((LPCHOOSECOLORA)lpcc); // call ASCII version
177
178 // free temporary ASCII string and restore UNICODE string
179 if (lpcc->lpTemplateName != NULL)
180 {
181 FreeAsciiString((char*)lpcc->lpTemplateName);
182 lpcc->lpTemplateName = lpTemplateNameBackup;
183 }
184
185 return bResult;
186}
187
188
189/*****************************************************************************
190 * Name :
191 * Purpose :
192 * Parameters:
193 * Variables :
194 * Result :
195 * Remark :
196 * Status :
197 *
198 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
199 *****************************************************************************/
200
201BOOL WIN32API ChooseFontA(LPCHOOSEFONTA lpcf)
202{
203 Win32WindowProc *wndproc;
204
205 dprintf(("COMDLG32: ChooseFontA(%08xh).\n",
206 lpcf));
207
208 COMDLG32_CHECKHOOK(lpcf, CF_ENABLEHOOK, WNDPROC)
209
210 return O32_ChooseFont(lpcf);
211}
212
213
214/*****************************************************************************
215 * Name :
216 * Purpose :
217 * Parameters:
218 * Variables :
219 * Result :
220 * Remark : unknown yet, what is INPUT and what is OUTPUT string
221 * Status :
222 *
223 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
224 *****************************************************************************/
225
226BOOL WIN32API ChooseFontW(LPCHOOSEFONTW lpcf)
227{
228 Win32WindowProc *wndproc;
229 BOOL bResult;
230 CHOOSEFONTA asciicf;
231 LOGFONTA asciilf;
232 char szAsciiStyle[64];
233
234 // NOTE: LOGFONTW/A is NOT converted !
235 dprintf(("COMDLG32: ChooseFontW(%08xh) not correctly implemented.\n",
236 lpcf));
237
238 // convert to ASCII string
239 memcpy(&asciicf, // make binary copy of CHOOSEFONTW
240 lpcf, // to save the flags
241 sizeof(asciicf));
242
243 memcpy (&asciilf,
244 lpcf->lpLogFont,
245 sizeof(LOGFONTA));
246
247 asciicf.lpLogFont = &asciilf; // update pointer
248
249
250 // now translate the strings
251 if (lpcf->Flags & CF_ENABLETEMPLATE)
252 asciicf.lpTemplateName = UnicodeToAsciiString((LPWSTR)lpcf->lpTemplateName);
253 else
254 asciicf.lpTemplateName = NULL;
255
256 UnicodeToAsciiN(lpcf->lpszStyle,
257 szAsciiStyle,
258 sizeof(szAsciiStyle));
259 asciicf.lpszStyle = szAsciiStyle;
260
261 UnicodeToAsciiN(lpcf->lpLogFont->lfFaceName,
262 asciilf.lfFaceName,
263 LF_FACESIZE);
264
265 // LPCFHOOKPROC != WNDPROC ?
266 COMDLG32_CHECKHOOK(lpcf, CF_ENABLEHOOK, WNDPROC)
267
268 // switch strings
269 bResult = O32_ChooseFont((LPCHOOSEFONTA)&asciicf); // call ASCII version
270
271 // transfer BACK resulting strings !!!
272 AsciiToUnicodeN(asciicf.lpLogFont->lfFaceName,
273 lpcf->lpLogFont->lfFaceName,
274 LF_FACESIZE);
275
276 AsciiToUnicode(asciicf.lpszStyle,
277 lpcf->lpszStyle);
278
279 if(asciicf.lpTemplateName != NULL)
280 FreeAsciiString((char*)asciicf.lpTemplateName);
281
282 // copy back fields
283 lpcf->Flags = asciicf.Flags;
284
285 return bResult;
286}
287
288
289/*****************************************************************************
290 * Name :
291 * Purpose :
292 * Parameters:
293 * Variables :
294 * Result :
295 * Remark :
296 * Status :
297 *
298 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
299 *****************************************************************************/
300
301DWORD WIN32API CommDlgExtendedError(void)
302{
303 dprintf(("COMDLG32: ComDlgExtendedError()\n"));
304
305 return O32_CommDlgExtendedError();
306}
307
308
309/*****************************************************************************
310 * Name :
311 * Purpose :
312 * Parameters:
313 * Variables :
314 * Result :
315 * Remark :
316 * Status :
317 *
318 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
319 *****************************************************************************/
320
321HWND WIN32API FindTextA(LPFINDREPLACEA lpfr)
322{
323 Win32WindowProc *wndproc;
324
325 dprintf(("COMDLG32: FindTextA(%08xh).\n",
326 lpfr));
327
328 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
329
330 return O32_FindText(lpfr);
331}
332
333
334/*****************************************************************************
335 * Name :
336 * Purpose :
337 * Parameters:
338 * Variables :
339 * Result :
340 * Remark :
341 * Status :
342 *
343 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
344 *****************************************************************************/
345
346HWND WIN32API FindTextW(LPFINDREPLACEW lpfr)
347{
348 Win32WindowProc *wndproc;
349 BOOL bResult;
350 FINDREPLACEA fr;
351
352 dprintf(("COMDLG32: FindTextW(%08xh)\n",
353 lpfr));
354
355 memcpy(&fr, // make binary copy first to save all the fields
356 lpfr,
357 sizeof(fr));
358
359 // convert to ASCII string
360 if ((lpfr->Flags & FR_ENABLETEMPLATE) &&
361 (lpfr->lpTemplateName != NULL))
362 fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);
363 else
364 fr.lpTemplateName = NULL;
365
366 if (lpfr->lpstrFindWhat != NULL)
367 fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);
368
369 if (lpfr->lpstrReplaceWith != NULL)
370 fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);
371
372
373 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
374
375 bResult = O32_FindText(&fr); // call ASCII version
376
377 // @@@PH: Note -- we might have to transfer BACK resulting strings !!!
378 // free temporary ASCII string and restore UNICODE string
379 if (fr.lpTemplateName != NULL)
380 FreeAsciiString((char*)fr.lpTemplateName);
381
382 // free temporary ASCII string and restore UNICODE string
383 if (fr.lpstrFindWhat != NULL)
384 {
385 AsciiToUnicode(fr.lpstrFindWhat,
386 lpfr->lpstrFindWhat);
387
388 FreeAsciiString((char*)fr.lpstrFindWhat);
389 }
390
391 if (fr.lpstrReplaceWith != NULL)
392 {
393 AsciiToUnicode(fr.lpstrReplaceWith,
394 lpfr->lpstrReplaceWith);
395
396 FreeAsciiString((char*)fr.lpstrReplaceWith);
397 }
398
399 // copy back fields
400 lpfr->Flags = fr.Flags;
401
402 return bResult;
403}
404
405
406/*****************************************************************************
407 * Name :
408 * Purpose :
409 * Parameters:
410 * Variables :
411 * Result :
412 * Remark :
413 * Status :
414 *
415 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
416 *****************************************************************************/
417
418INT16 WIN32API GetFileTitleW(LPCWSTR lpFile,
419 LPWSTR lpTitle,
420 UINT cbBuf)
421{
422 LPSTR lpFileBackup;
423 char szTitle[256];
424 INT16 iResult;
425
426 dprintf(("COMDLG32: GetFileTitleW(%08xh,%08xh,%08xh).\n",
427 lpFile,
428 lpTitle,
429 cbBuf));
430
431 lpFileBackup = UnicodeToAsciiString((LPWSTR)lpFile);
432 iResult = O32_GetFileTitle(lpFileBackup,
433 szTitle,
434 cbBuf);
435
436 FreeAsciiString(lpFileBackup);
437
438 // transform result into Unicode
439 AsciiToUnicode(szTitle,
440 lpTitle);
441
442 return iResult;
443}
444
445
446/*****************************************************************************
447 * Name :
448 * Purpose :
449 * Parameters:
450 * Variables :
451 * Result :
452 * Remark :
453 * Status :
454 *
455 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
456 *****************************************************************************/
457
458BOOL WIN32API GetOpenFileNameW(LPOPENFILENAMEW lpofn)
459{
460 Win32WindowProc *wndproc;
461 OPENFILENAMEA ofn;
462 char* szFile;
463 char* szFileTitle;
464 char* szCustFilter;
465 BOOL bResult;
466
467 dprintf(("COMDLG32: GetOpenFileNameW(%08xh)\n",
468 lpofn));
469
470 memcpy(&ofn, // make binary copy first to save all the fields
471 lpofn,
472 sizeof(ofn));
473
474 // convert to ASCII string
475 if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
476 (lpofn->lpTemplateName != NULL))
477 ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
478 else
479 ofn.lpTemplateName = NULL;
480
481 if (lpofn->lpstrFilter != NULL)
482 ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
483
484 if (lpofn->lpstrInitialDir != NULL)
485 ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
486
487 if (lpofn->lpstrTitle != NULL)
488 ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
489
490 if (lpofn->lpstrDefExt != NULL)
491 ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
492
493 szFile = (char*)malloc(lpofn->nMaxFile);
494 szFile[0] = 0;
495
496 if (*lpofn->lpstrFile != 0)
497 UnicodeToAscii(lpofn->lpstrFile,
498 szFile);
499
500 if (lpofn->lpstrFileTitle != NULL)
501 {
502 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle);
503 szFileTitle[0] = 0;
504
505 if (*lpofn->lpstrFileTitle != 0)
506 UnicodeToAscii(lpofn->lpstrFileTitle,
507 szFileTitle);
508 }
509 else
510 szFileTitle = NULL;
511
512 if (lpofn->lpstrCustomFilter != NULL)
513 {
514 szCustFilter = (char*)malloc(lpofn->nMaxCustFilter);
515 szCustFilter[0] = 0;
516
517
518 if (*lpofn->lpstrCustomFilter != 0)
519 UnicodeToAscii(lpofn->lpstrCustomFilter,
520 szCustFilter);
521 }
522 else
523 szCustFilter = NULL;
524
525 ofn.lpstrFile = szFile;
526 ofn.lpstrFileTitle = szFileTitle;
527 ofn.lpstrCustomFilter = szCustFilter;
528
529 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
530
531 bResult = O32_GetOpenFileName(&ofn);
532
533 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
534 if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
535 if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
536 if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
537 if (ofn.lpstrDefExt != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
538
539 // transform back the result
540 AsciiToUnicode(ofn.lpstrFile,
541 lpofn->lpstrFile);
542 free(szFile);
543
544 if (lpofn->lpstrFileTitle != NULL)
545 {
546 AsciiToUnicode(ofn.lpstrFileTitle,
547 lpofn->lpstrFileTitle);
548 free(szFileTitle);
549 }
550
551 if (lpofn->lpstrCustomFilter != NULL)
552 {
553 AsciiToUnicode(ofn.lpstrCustomFilter,
554 lpofn->lpstrCustomFilter);
555 free(szCustFilter);
556 }
557
558 // copy over some altered flags
559 lpofn->nFilterIndex = ofn.nFilterIndex;
560 lpofn->Flags = ofn.Flags;
561 lpofn->nFileOffset = ofn.nFileOffset;
562 lpofn->nFileExtension = ofn.nFileExtension;
563
564 return bResult;
565}
566
567
568/*****************************************************************************
569 * Name :
570 * Purpose :
571 * Parameters:
572 * Variables :
573 * Result :
574 * Remark :
575 * Status :
576 *
577 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
578 *****************************************************************************/
579
580BOOL WIN32API GetSaveFileNameW(LPOPENFILENAMEW lpofn)
581{
582 Win32WindowProc *wndproc;
583 OPENFILENAMEA ofn;
584 char* szFile;
585 char* szFileTitle;
586 char* szCustFilter;
587 BOOL bResult;
588
589 dprintf(("COMDLG32: GetSaveFileNameW(%08xh)\n",
590 lpofn));
591
592 memcpy(&ofn, // make binary copy first to save all the fields
593 lpofn,
594 sizeof(ofn));
595
596 // convert to ASCII string
597 if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
598 (lpofn->lpTemplateName != NULL))
599 ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
600 else
601 ofn.lpTemplateName = NULL;
602
603 if (lpofn->lpstrFilter != NULL)
604 ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
605
606 if (lpofn->lpstrInitialDir != NULL)
607 ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
608
609 if (lpofn->lpstrTitle != NULL)
610 ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
611
612 if (lpofn->lpstrDefExt != NULL)
613 ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
614
615 szFile = (char*)malloc(lpofn->nMaxFile);
616 szFile[0] = 0;
617
618 if (*lpofn->lpstrFile != 0)
619 UnicodeToAscii(lpofn->lpstrFile,
620 szFile);
621
622 if (lpofn->lpstrFileTitle != NULL)
623 {
624 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle);
625 szFileTitle[0] = 0;
626
627 if (*lpofn->lpstrFileTitle != 0)
628 UnicodeToAscii(lpofn->lpstrFileTitle,
629 szFileTitle);
630 }
631 else
632 szFileTitle = NULL;
633
634 if (lpofn->lpstrCustomFilter != NULL)
635 {
636 szCustFilter = (char*)malloc(lpofn->nMaxCustFilter);
637 szCustFilter[0] = 0;
638
639
640 if (*lpofn->lpstrCustomFilter != 0)
641 UnicodeToAscii(lpofn->lpstrCustomFilter,
642 szCustFilter);
643 }
644 else
645 szCustFilter = NULL;
646
647 ofn.lpstrFile = szFile;
648 ofn.lpstrFileTitle = szFileTitle;
649 ofn.lpstrCustomFilter = szCustFilter;
650
651 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
652
653 bResult = O32_GetSaveFileName(&ofn);
654
655 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
656 if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
657 if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
658 if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
659 if (ofn.lpstrDefExt != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
660
661 // transform back the result
662 AsciiToUnicode(ofn.lpstrFile,
663 lpofn->lpstrFile);
664 free(szFile);
665
666 if (lpofn->lpstrFileTitle != NULL)
667 {
668 AsciiToUnicode(ofn.lpstrFileTitle,
669 lpofn->lpstrFileTitle);
670 free(szFileTitle);
671 }
672
673 if (lpofn->lpstrCustomFilter != NULL)
674 {
675 AsciiToUnicode(ofn.lpstrCustomFilter,
676 lpofn->lpstrCustomFilter);
677 free(szCustFilter);
678 }
679
680 // copy over some altered flags
681 lpofn->nFilterIndex = ofn.nFilterIndex;
682 lpofn->Flags = ofn.Flags;
683 lpofn->nFileOffset = ofn.nFileOffset;
684 lpofn->nFileExtension = ofn.nFileExtension;
685
686 return bResult;
687}
688
689
690/*****************************************************************************
691 * Name :
692 * Purpose :
693 * Parameters:
694 * Variables :
695 * Result :
696 * Remark :
697 * Status :
698 *
699 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
700 *****************************************************************************/
701
702BOOL WIN32API PrintDlgA(LPPRINTDLGA lppd)
703{
704 Win32WindowProc *wndproc;
705
706 dprintf(("COMDLG32: PrintDlgA(%08xh)\n",
707 lppd));
708
709 COMDLG32_CHECKHOOK2(lppd, PD_ENABLEPRINTHOOK, LPPRINTHOOKPROC,lpfnPrintHook)
710 COMDLG32_CHECKHOOK2(lppd, PD_ENABLESETUPHOOK, LPSETUPHOOKPROC,lpfnSetupHook)
711
712 return O32_PrintDlg(lppd);
713}
714
715
716/*****************************************************************************
717 * Name :
718 * Purpose :
719 * Parameters:
720 * Variables :
721 * Result :
722 * Remark :
723 * Status :
724 *
725 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
726 *****************************************************************************/
727
728BOOL WIN32API PrintDlgW(LPPRINTDLGW lppd)
729{
730 Win32WindowProc *wndproc;
731
732 PRINTDLGA pd;
733 BOOL bResult;
734
735 dprintf(("COMDLG32: PrintDlgW(%08xh)\n",
736 lppd));
737
738 memcpy(&pd, // make binary copy first to save all the fields
739 lppd,
740 sizeof(pd));
741
742 // convert to ASCII string
743 if ((lppd->Flags & PD_ENABLEPRINTTEMPLATE) &&
744 (lppd->lpPrintTemplateName != NULL))
745 pd.lpPrintTemplateName = UnicodeToAsciiString((WCHAR*)lppd->lpPrintTemplateName);
746 else
747 pd.lpPrintTemplateName = NULL;
748
749 if ((lppd->Flags & PD_ENABLESETUPTEMPLATE) &&
750 (lppd->lpSetupTemplateName != NULL))
751 pd.lpSetupTemplateName = UnicodeToAsciiString((WCHAR*)lppd->lpSetupTemplateName);
752 else
753 pd.lpSetupTemplateName = NULL;
754
755 COMDLG32_CHECKHOOK2(lppd, PD_ENABLEPRINTHOOK, LPPRINTHOOKPROC,lpfnPrintHook)
756 COMDLG32_CHECKHOOK2(lppd, PD_ENABLESETUPHOOK, LPSETUPHOOKPROC,lpfnSetupHook)
757
758 bResult = O32_PrintDlg(&pd); // call ASCII API
759
760 if (pd.lpPrintTemplateName != NULL) FreeAsciiString((char*)pd.lpPrintTemplateName);
761 if (pd.lpSetupTemplateName != NULL) FreeAsciiString((char*)pd.lpSetupTemplateName);
762
763 // copy back result
764 lppd->Flags = pd.Flags;
765 lppd->nFromPage = pd.nFromPage;
766 lppd->nToPage = pd.nToPage;
767 lppd->nMinPage = pd.nMinPage;
768 lppd->nMaxPage = pd.nMaxPage;
769 lppd->nCopies = pd.nCopies;
770 //@@@PH: all pass-back fields ?
771
772 return bResult;
773}
774
775
776/*****************************************************************************
777 * Name :
778 * Purpose :
779 * Parameters:
780 * Variables :
781 * Result :
782 * Remark :
783 * Status :
784 *
785 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
786 *****************************************************************************/
787
788HWND WIN32API ReplaceTextA(LPFINDREPLACEA lpfr)
789{
790 Win32WindowProc *wndproc;
791
792 dprintf(("COMDLG32: ReplaceTextA(%08xh).\n",
793 lpfr));
794
795 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
796
797 return O32_ReplaceText(lpfr);
798}
799
800
801/*****************************************************************************
802 * Name :
803 * Purpose :
804 * Parameters:
805 * Variables :
806 * Result :
807 * Remark :
808 * Status :
809 *
810 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
811 *****************************************************************************/
812
813HWND WIN32API ReplaceTextW(LPFINDREPLACEW lpfr)
814{
815 Win32WindowProc *wndproc;
816 BOOL bResult;
817 FINDREPLACEA fr;
818
819 dprintf(("COMDLG32: ReplaceTextW(%08xh)\n",
820 lpfr));
821
822 memcpy(&fr, // make binary copy first to save all the fields
823 lpfr,
824 sizeof(fr));
825
826 // convert to ASCII string
827 if ((lpfr->Flags & FR_ENABLETEMPLATE) &&
828 (lpfr->lpTemplateName != NULL))
829 fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);
830 else
831 fr.lpTemplateName = NULL;
832
833 if (lpfr->lpstrFindWhat != NULL)
834 fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);
835
836 if (lpfr->lpstrReplaceWith != NULL)
837 fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);
838
839
840 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
841
842 bResult = O32_ReplaceText(&fr); // call ASCII version
843
844 // @@@PH: Note -- we might have to transfer BACK resulting strings !!!
845 // free temporary ASCII string and restore UNICODE string
846 if (fr.lpTemplateName != NULL)
847 FreeAsciiString((char*)fr.lpTemplateName);
848
849 // free temporary ASCII string and restore UNICODE string
850 if (fr.lpstrFindWhat != NULL)
851 {
852 AsciiToUnicode(fr.lpstrFindWhat,
853 lpfr->lpstrFindWhat);
854
855 FreeAsciiString((char*)fr.lpstrFindWhat);
856 }
857
858 if (fr.lpstrReplaceWith != NULL)
859 {
860 AsciiToUnicode(fr.lpstrReplaceWith,
861 lpfr->lpstrReplaceWith);
862
863 FreeAsciiString((char*)fr.lpstrReplaceWith);
864 }
865
866 // copy back fields
867 lpfr->Flags = fr.Flags;
868
869 return bResult;
870}
871
872
873/*****************************************************************************
874 * Name :
875 * Purpose :
876 * Parameters:
877 * Variables :
878 * Result :
879 * Remark :
880 * Status :
881 *
882 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
883 *****************************************************************************/
884
885BOOL WIN32API PageSetupDlgA(LPPAGESETUPDLGA lppsd)
886{
887 Win32WindowProc *wndproc;
888
889 dprintf(("COMDLG32: PageSetupDlgA(%08xh) not implemented.\n",
890 lppsd));
891
892 //COMDLG32_CHECKHOOK2(lppsd, PSD_ENABLESETUPHOOK, LPPAGESETUPHOOK, lpfnPageSetupHook)
893
894 return(FALSE);
895}
896
897
898/*****************************************************************************
899 * Name :
900 * Purpose :
901 * Parameters:
902 * Variables :
903 * Result :
904 * Remark :
905 * Status :
906 *
907 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
908 *****************************************************************************/
909
910BOOL WIN32API PageSetupDlgW(LPPAGESETUPDLGW lppsd)
911{
912 Win32WindowProc *wndproc;
913
914 dprintf(("COMDLG32: PageSetupDlgW(%08xh) not implemented.\n",
915 lppsd));
916
917 //COMDLG32_CHECKHOOK2(lppsd, PSD_ENABLESETUPHOOK, LPPAGESETUPHOOK, lpfnPageSetupHook)
918
919 return(FALSE);
920}
Note: See TracBrowser for help on using the repository browser.