| 1 |
/* AbiSource Application Framework |
| 2 |
* Copyright (C) 1998 AbiSource, Inc. |
| 3 |
* BIDI Copyright (c) 2001,2002 Tomas Frydrych |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU General Public License |
| 7 |
* as published by the Free Software Foundation; either version 2 |
| 8 |
* of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 |
* 02110-1301 USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
|
| 22 |
#ifndef XAP_WIN32APP_H |
| 23 |
#define XAP_WIN32APP_H |
| 24 |
|
| 25 |
#include <windows.h> |
| 26 |
#include <tchar.h> |
| 27 |
#include "xap_App.h" |
| 28 |
#include "xap_Win32DialogFactory.h" |
| 29 |
#include "xap_Win32_TB_CFactory.h" |
| 30 |
#include "xap_Strings.h" |
| 31 |
|
| 32 |
#define MAX_CONVBUFFER 256 |
| 33 |
|
| 34 |
class XAP_Win32Slurp; |
| 35 |
class XAP_Win32Toolbar_Icons; |
| 36 |
|
| 37 |
/***************************************************************** |
| 38 |
****************************************************************** |
| 39 |
** Only one of these is created by the application. |
| 40 |
****************************************************************** |
| 41 |
*****************************************************************/ |
| 42 |
|
| 43 |
class ABI_EXPORT XAP_Win32App : public XAP_App |
| 44 |
{ |
| 45 |
public: |
| 46 |
XAP_Win32App(HINSTANCE hInstance, const char * szAppName); |
| 47 |
virtual ~XAP_Win32App(void); |
| 48 |
|
| 49 |
virtual const char * getDefaultEncoding () const; |
| 50 |
|
| 51 |
static const WCHAR * getWideString (const char * p_str); |
| 52 |
static const char * getUTF8String (const WCHAR * p_str); |
| 53 |
|
| 54 |
virtual bool initialize(const char * szKeyBindingsKey, const char * szKeyBindingsDefaultValue); |
| 55 |
virtual XAP_Frame * newFrame(void) = 0; |
| 56 |
virtual void reallyExit(void); |
| 57 |
|
| 58 |
virtual HINSTANCE getInstance() const; |
| 59 |
|
| 60 |
virtual XAP_DialogFactory * getDialogFactory(void); |
| 61 |
virtual XAP_Toolbar_ControlFactory * getControlFactory(void); |
| 62 |
virtual const XAP_StringSet * getStringSet(void) const = 0; |
| 63 |
virtual const char * getAbiSuiteAppDir(void) const = 0; |
| 64 |
virtual void copyToClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard = true) = 0; |
| 65 |
virtual void pasteFromClipboard(PD_DocumentRange * pDocRange, bool, bool) = 0; |
| 66 |
virtual bool canPasteFromClipboard(void) = 0; |
| 67 |
virtual void cacheCurrentSelection(AV_View *) = 0; |
| 68 |
virtual const char * getUserPrivateDirectory(void); |
| 69 |
|
| 70 |
virtual HICON getIcon(void) = 0; |
| 71 |
virtual HICON getSmallIcon(void) = 0; |
| 72 |
|
| 73 |
virtual UT_Error fileOpen(XAP_Frame * pFrame, const char * pNewFile) = 0; |
| 74 |
|
| 75 |
void enableAllTopLevelWindows(bool); |
| 76 |
virtual UT_sint32 makeDirectory(const char * szPath, const UT_sint32 mode ) const; |
| 77 |
virtual UT_sint32 setupWindowFromPrefs(UT_sint32 iCmdShow, HWND hwndFrame); |
| 78 |
virtual XAP_App::BidiSupportType theOSHasBidiSupport() const {return m_eBidiOS;} |
| 79 |
|
| 80 |
void getDefaultGeometry(UT_uint32& width, |
| 81 |
UT_uint32& height, |
| 82 |
UT_uint32& flags); |
| 83 |
|
| 84 |
void setHKL(HKL hkl) {m_hkl = hkl;} |
| 85 |
HKL getHKL()const {return m_hkl;} |
| 86 |
void setKbdLanguage(HKL hkl); |
| 87 |
|
| 88 |
protected: |
| 89 |
UT_uint32 _getExeDir(LPWSTR pDirBuf, UT_uint32 iBufLen); |
| 90 |
void _setAbiSuiteLibDir(void); |
| 91 |
void _setBidiOS(void); |
| 92 |
virtual const char * _getKbdLanguage(); |
| 93 |
|
| 94 |
HINSTANCE m_hInstance; |
| 95 |
AP_Win32DialogFactory m_dialogFactory; |
| 96 |
AP_Win32Toolbar_ControlFactory m_controlFactory; |
| 97 |
|
| 98 |
XAP_Win32Slurp * m_pSlurp; |
| 99 |
static char m_buffer[MAX_CONVBUFFER*6]; |
| 100 |
static WCHAR m_wbuffer[MAX_CONVBUFFER]; |
| 101 |
|
| 102 |
private: |
| 103 |
XAP_App::BidiSupportType m_eBidiOS; |
| 104 |
HKL m_hkl; // kbd layout |
| 105 |
// handle |
| 106 |
}; |
| 107 |
|
| 108 |
#endif /* XAP_WIN32APP_H */ |