Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef XAP_COCOAAPP_H
00025 #define XAP_COCOAAPP_H
00026
00027
00028
00029 typedef double NSTimeInterval;
00030
00031 #include <unistd.h>
00032 #include <sys/stat.h>
00033 #include "xap_App.h"
00034 #include "xap_CocoaDialogFactory.h"
00035 #include "xap_Cocoa_TB_CFactory.h"
00036
00037 class XAP_Args;
00038 class XAP_CocoaToolbar_Icons;
00039 class AV_View;
00040 class EV_CocoaMenuBar;
00041
00042
00043
00044
00045
00046
00047
00048 class XAP_CocoaApp : public XAP_App
00049 {
00050 public:
00051 XAP_CocoaApp(const char* szAppName);
00052 virtual ~XAP_CocoaApp();
00053
00054 virtual const char * getDefaultEncoding () const;
00055
00056 virtual bool initialize(const char * szKeyBindingsKey, const char * szKeyBindingsDefaultValue);
00057 virtual XAP_Frame * newFrame() = 0;
00058 virtual void reallyExit();
00059 virtual void notifyFrameCountChange ();
00060
00061 virtual XAP_DialogFactory * getDialogFactory();
00062 virtual XAP_Toolbar_ControlFactory * getControlFactory();
00063 virtual const XAP_StringSet * getStringSet() const = 0;
00064 virtual const char * getAbiSuiteAppDir() const = 0;
00065 virtual void copyToClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard = true) = 0;
00066 virtual void pasteFromClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard, bool bHonorFormatting = true) = 0;
00067 virtual bool canPasteFromClipboard() = 0;
00068 virtual const char * getUserPrivateDirectory() const;
00069 virtual bool findAbiSuiteBundleFile(std::string & path, const char * filename, const char * subdir = 0);
00070 virtual bool findAbiSuiteLibFile(std::string & path, const char * filename, const char * subdir = 0);
00071 virtual bool findAbiSuiteAppFile(std::string & path, const char * filename, const char * subdir = 0);
00072
00073 virtual void setSelectionStatus(AV_View * pView) = 0;
00074 virtual void clearSelection() = 0;
00075 virtual bool getCurrentSelection(const char** formatList,
00076 void ** ppData, UT_uint32 * pLen,
00077 const char **pszFormatFound) = 0;
00078 virtual void cacheCurrentSelection(AV_View *) = 0;
00079
00080 typedef enum
00081 {
00082 GEOMETRY_FLAG_POS = 1 << 0,
00083 GEOMETRY_FLAG_SIZE = 1 << 1
00084 } windowGeometryFlags;
00085
00086 struct windowGeometry
00087 {
00088 int x, y;
00089 UT_uint32 width, height;
00090 XAP_CocoaApp::windowGeometryFlags flags;
00091 };
00092
00093 virtual void setGeometry(int x, int y, UT_uint32 width, UT_uint32 height,
00094 windowGeometryFlags flags);
00095 virtual void getGeometry(int * x, int * y, UT_uint32 * width, UT_uint32 * height,
00096 windowGeometryFlags * flags);
00097
00098 void setTimeOfLastEvent(NSTimeInterval eventTime);
00099 NSTimeInterval getTimeOfLastEvent() const { return m_eventTime; };
00100 virtual BidiSupportType theOSHasBidiSupport() const;
00101 EV_CocoaMenuBar* getCocoaMenuBar(void) const { return m_pCocoaMenu; };
00102 XAP_Frame * _getFrontFrame(void);
00103 XAP_CocoaToolbar_Icons * getToolbarIcons () const { return m_pCocoaToolbarIcons; }
00104 protected:
00105 virtual const char* _findNearestFont(const char* pszFontFamily,
00106 const char* pszFontStyle,
00107 const char* pszFontVariant,
00108 const char* pszFontWeight,
00109 const char* pszFontStretch,
00110 const char* pszFontSize,
00111 const char* pszLang);
00112 bool _loadFonts();
00113 void _setAbiSuiteLibDir();
00114 private:
00115 XAP_CocoaToolbar_Icons * m_pCocoaToolbarIcons;
00116 AP_CocoaDialogFactory m_dialogFactory;
00117 AP_CocoaToolbar_ControlFactory m_controlFactory;
00118
00119 windowGeometry m_geometry;
00120 NSTimeInterval m_eventTime;
00121
00122
00123
00124 protected:
00125 EV_CocoaMenuBar* m_pCocoaMenu;
00126 const char* m_szMenuLayoutName;
00127 const char* m_szMenuLabelSetName;
00128 };
00129
00130 #endif