1 /* AbiSource Application Framework
2  * Copyright (C) 1998 AbiSource, Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA.
18  */
19 
20 #ifndef XAP_WIN32DIALOG_FILEOPENSAVEAS_H
21 #define XAP_WIN32DIALOG_FILEOPENSAVEAS_H
22 
23 #include "xap_Dlg_FileOpenSaveAs.h"
24 #include "xap_Win32DialogBase.h"
25 
26 class UT_String;
27 #include "xap_Frame.h"
28 
29 #define DEFAULT_EXT_SIZE 15
30 
31 /*****************************************************************/
32 
33 class ABI_EXPORT XAP_Win32Dialog_FileOpenSaveAs : public XAP_Dialog_FileOpenSaveAs, public XAP_Win32DialogBase
34 {
35 public:
36 	XAP_Win32Dialog_FileOpenSaveAs(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
37 	virtual ~XAP_Win32Dialog_FileOpenSaveAs(void);
38 
39 	virtual void			runModal(XAP_Frame * pFrame);
40 
41 	static XAP_Dialog * 	static_constructor(XAP_DialogFactory *, XAP_Dialog_Id id);
42 	static UINT CALLBACK	s_hookSaveAsProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
43 	static UINT CALLBACK	s_hookInsertPicProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
44 
45 protected:
46 	UINT _previewPicture(HWND hwnd);
47 	UINT _initPreviewDlg(HWND hwnd);
48 
49 	void _buildFilterList(UT_String& sFilter);
50 private:
51 	const wchar_t * _getDefaultExtension(UT_uint32 indx);
52 	wchar_t m_szDefaultExtension[DEFAULT_EXT_SIZE + 1];
53 
54 	//
55 	// This the new OPENFILENAME struct included in the most
56 	// recent Plataforms SDK.
57 	//
58 	struct OPENFILENAME_WIN50
59 	{
60 			DWORD         lStructSize;
61 			HWND          hwndOwner;
62 			HINSTANCE     hInstance;
63 			LPCWSTR       lpstrFilter;
64 			LPWSTR        lpstrCustomFilter;
65 			DWORD         nMaxCustFilter;
66 			DWORD         nFilterIndex;
67 			LPWSTR        lpstrFile;
68 			DWORD         nMaxFile;
69 			LPWSTR        lpstrFileTitle;
70 			DWORD         nMaxFileTitle;
71 			LPCWSTR       lpstrInitialDir;
72 			LPCWSTR       lpstrTitle;
73 			DWORD         Flags;
74 			WORD          nFileOffset;
75 			WORD          nFileExtension;
76 			LPCWSTR       lpstrDefExt;
77 			LPARAM        lCustData;
78 			LPOFNHOOKPROC lpfnHook;
79 			LPCWSTR       lpTemplateName;
80 
81 			//#if (_WIN32_WINNT >= 0x0500)
82 			void *        pvReserved;
83 			DWORD         dwReserved;
84 			DWORD         FlagsEx;
85 			//#endif // (_WIN32_WINNT >= 0x0500)
86 	};
87 
88 	BOOL GetSaveFileName_Hooked(OPENFILENAME_WIN50* lpofn,  BOOL bSave);
89 
90 };
91 
92 #endif /* XAP_WIN32DIALOG_FILEOPENSAVEAS_H */
93