| 1 |
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ |
| 2 |
|
| 3 |
/* AbiSource Application Framework |
| 4 |
* Copyright (C) 1998 AbiSource, Inc. |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU General Public License |
| 8 |
* as published by the Free Software Foundation; either version 2 |
| 9 |
* of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 19 |
* 02110-1301 USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
/* |
| 23 |
* Port to Maemo Development Platform |
| 24 |
* Author: INdT - Renato Araujo <[email protected]> |
| 25 |
*/ |
| 26 |
|
| 27 |
|
| 28 |
#ifndef XAP_UNIXAPP_H |
| 29 |
#define XAP_UNIXAPP_H |
| 30 |
|
| 31 |
#ifdef HAVE_CONFIG_H |
| 32 |
#include "config.h" |
| 33 |
#endif |
| 34 |
|
| 35 |
#include <unistd.h> |
| 36 |
#include <sys/stat.h> |
| 37 |
#include "xap_App.h" |
| 38 |
#include "xap_UnixDialogFactory.h" |
| 39 |
#include "xap_Unix_TB_CFactory.h" |
| 40 |
|
| 41 |
class AP_UnixToolbar_Icons; |
| 42 |
class AV_View; |
| 43 |
class XAP_UnixClipboard; |
| 44 |
|
| 45 |
/***************************************************************** |
| 46 |
****************************************************************** |
| 47 |
** Only one of these is created by the application. |
| 48 |
****************************************************************** |
| 49 |
*****************************************************************/ |
| 50 |
|
| 51 |
class ABI_EXPORT XAP_UnixApp : public XAP_App |
| 52 |
{ |
| 53 |
public: |
| 54 |
XAP_UnixApp(const char* szAppName); |
| 55 |
virtual ~XAP_UnixApp(); |
| 56 |
|
| 57 |
virtual const char * getDefaultEncoding () const |
| 58 |
{ |
| 59 |
return "UTF-8" ; |
| 60 |
} |
| 61 |
|
| 62 |
virtual bool initialize(const char * szKeyBindingsKey, const char * szKeyBindingsDefaultValue); |
| 63 |
void shutdown(); |
| 64 |
virtual XAP_Frame * newFrame() = 0; |
| 65 |
virtual void reallyExit(); |
| 66 |
|
| 67 |
virtual XAP_DialogFactory * getDialogFactory(); |
| 68 |
virtual XAP_Toolbar_ControlFactory * getControlFactory(); |
| 69 |
virtual const XAP_StringSet * getStringSet() const = 0; |
| 70 |
virtual const char * getAbiSuiteAppDir() const = 0; |
| 71 |
virtual const std::string& getAbiSuiteAppUIDir() const = 0; |
| 72 |
virtual void copyToClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard = true) = 0; |
| 73 |
virtual void pasteFromClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard, bool bHonorFormatting = true) = 0; |
| 74 |
virtual bool canPasteFromClipboard() = 0; |
| 75 |
void migrate(const char *oldName, const char *newName, const char *path) const; |
| 76 |
virtual const char * getUserPrivateDirectory(); |
| 77 |
|
| 78 |
virtual void setSelectionStatus(AV_View * pView) = 0; |
| 79 |
virtual void clearSelection() = 0; |
| 80 |
virtual bool getCurrentSelection(const char** formatList, |
| 81 |
void ** ppData, UT_uint32 * pLen, |
| 82 |
const char **pszFormatFound) = 0; |
| 83 |
virtual void cacheCurrentSelection(AV_View *) = 0; |
| 84 |
|
| 85 |
virtual XAP_UnixClipboard * getClipboard () = 0; |
| 86 |
|
| 87 |
enum |
| 88 |
{ |
| 89 |
GEOMETRY_FLAG_POS = 1 << 0, |
| 90 |
GEOMETRY_FLAG_SIZE = 1 << 1 |
| 91 |
}; |
| 92 |
|
| 93 |
struct windowGeometry |
| 94 |
{ |
| 95 |
int x, y; |
| 96 |
UT_uint32 width, height; |
| 97 |
UT_uint32 flags; |
| 98 |
}; |
| 99 |
|
| 100 |
virtual void setWinGeometry(int x, int y, UT_uint32 width, UT_uint32 height, |
| 101 |
UT_uint32 flags); |
| 102 |
virtual void getWinGeometry(int * x, int * y, UT_uint32 * width, UT_uint32 * height, |
| 103 |
UT_uint32* flags); |
| 104 |
|
| 105 |
void setTimeOfLastEvent(UT_uint32 eventTime); |
| 106 |
UT_uint32 getTimeOfLastEvent() const { return m_eventTime; }; |
| 107 |
virtual UT_sint32 makeDirectory(const char * szPath, const UT_sint32 mode ) const; |
| 108 |
virtual XAP_App::BidiSupportType theOSHasBidiSupport() const {return BIDI_SUPPORT_GUI;} |
| 109 |
char ** getTmpFile(void) |
| 110 |
{ return &m_szTmpFile;} |
| 111 |
void removeTmpFile(void); |
| 112 |
protected: |
| 113 |
void _setAbiSuiteLibDir(); |
| 114 |
|
| 115 |
AP_UnixDialogFactory m_dialogFactory; |
| 116 |
AP_UnixToolbar_ControlFactory m_controlFactory; |
| 117 |
|
| 118 |
windowGeometry m_geometry; |
| 119 |
UT_uint32 m_eventTime; // e->time field of a recent X event |
| 120 |
// (we use this to sync clipboard |
| 121 |
// operations with the server). |
| 122 |
|
| 123 |
#if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON |
| 124 |
class XAP_UnixHildonApp * m_pUnixHildonApp; |
| 125 |
#endif |
| 126 |
char * m_szTmpFile; |
| 127 |
}; |
| 128 |
|
| 129 |
#endif /* XAP_UNIXAPP_H */ |