• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ap_Win32App.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 1998 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 /*****************************************************************
00021 ******************************************************************
00022 ** Only one of these is created by the application.
00023 ******************************************************************
00024 *****************************************************************/
00025 
00026 #ifndef AP_WIN32APP_H
00027 #define AP_WIN32APP_H
00028 
00029 #include "ap_App.h"
00030 #include "ap_Win32Prefs.h"
00031 #include "ap_Win32Clipboard.h"
00032 #include "ie_types.h"
00033 #include "ut_string_class.h"
00034 #include "ut_Win32LocaleString.h"
00035 
00036 /*
00037   The following turns on code that tries to place data on the
00038   clipboard on demand rather than blindly. The idea was that we place
00039   data on clipboard in RTF format only, cache the document state, and
00040   indicate that we can provide other formats if required.
00041 
00042   The main advantage, obviously, is being able to provide data for the
00043   clipboard in a myriad of formats, but without taking up system
00044   resources.
00045 
00046   At present this code is turned off, since we currently only put on
00047   the clipboard RTF and text and the latter is quite undemading as far
00048   as resources go. When we add more export formats, such as AW native,
00049   this line should be uncommented.
00050 
00051   Tomas, June 28, 2003
00052 */
00053 //#define COPY_ON_DEMAND
00054 
00055 
00056 class PD_DocumentRange;
00057 
00060 
00061 class ABI_EXPORT AP_Win32App : public AP_App
00062 {
00063 public:
00064     AP_Win32App(HINSTANCE hInstance, const char * szAppName);
00065     virtual ~AP_Win32App(void);
00066 
00067     virtual bool                    initialize(void);
00068     virtual XAP_Frame *             newFrame(void);
00069     virtual bool                    shutdown(void);
00070     virtual bool                    getPrefsValueDirectory(bool bAppSpecific,
00071                                                            const gchar * szKey, const gchar ** pszValue) const;
00072     virtual const XAP_StringSet *   getStringSet(void) const;
00073     virtual const char *            getAbiSuiteAppDir(void) const;
00074     virtual void                    copyToClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard = true);
00075     virtual GR_Graphics *           newDefaultScreenGraphics() const;
00076 
00077 
00078 #ifdef COPY_ON_DEMAND
00079     // see comments in the cpp file
00080     bool                            copyFmtToClipboardOnDemand(UINT iFmt);
00081     bool                            copyAllFmtsToClipboardOnDemand();
00082 #endif
00083 
00084     virtual void                    pasteFromClipboard(PD_DocumentRange * pDocRange, bool bUseClipboard, bool bHonorFormatting);
00085     virtual bool                    canPasteFromClipboard(void);
00086     virtual void                    cacheCurrentSelection(AV_View *) {};
00087 
00088     virtual void                    errorMsgBadArg(const char *msg);
00089     virtual void                    errorMsgBadFile(XAP_Frame * pFrame, const char * file, UT_Error error);
00090     virtual bool                    doWindowlessArgs (const AP_Args *, bool & bSuccess);
00091 
00092     static int WinMain (const char * szAppName, HINSTANCE hInstance,
00093                         HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow);
00094 
00095     virtual HICON                           getIcon(void);
00096     virtual HICON                           getSmallIcon(void);
00097 
00098     virtual UT_Error                        fileOpen(XAP_Frame * pFrame, const char * pNewFile);
00099     UT_Vector*                              getInstalledUILanguages(void);
00100     bool                                    doesStringSetExist(const char* pLocale);
00101 
00102     /*
00103         Currently we need single byte strings to work with
00104         win32 UI until we do a Unicode port. It's better to do all UI
00105         conversions in a single point. You are looking to this point right now. Jordi,
00106     */
00107     static UT_Win32LocaleString     s_fromUCS4ToWinLocale(const UT_UCS4Char * szIn);
00108     static UT_UCS4String    s_fromWinLocaleToUCS4(const char* szIn);
00109     static UT_Win32LocaleString     s_fromUTF8ToWinLocale(const char* szIn);
00110     static UT_UTF8String    s_fromWinLocaleToUTF8(const char* szIn);
00111 
00112 
00113 
00114     bool handleModelessDialogMessage( MSG * msg );
00115 
00116     virtual void catchSignals(int signum) ABI_NORETURN;
00117 
00118 private:
00119     bool               _copyFmtToClipboard(PD_DocumentRange * pDocRange, UINT iFmt);
00120     bool               _copyFmtToClipboard(PD_DocumentRange * pDocRange, const char *pszFmt);
00121 #ifdef COPY_ON_DEMAND
00122     bool               _cacheClipboardDoc(PD_DocumentRange *pDocRange);
00123     void               _indicateFmtToClipboard(const char * pszFmt) const;
00124 #endif
00125 protected:
00126 
00127     bool                    _pasteFormatFromClipboard(PD_DocumentRange * pDocRange, const char * szFormat,
00128                                                      const char * szType, bool bWide);
00129 
00130     IEFileType              _getFileTypeFromDesc(const char *desc);
00131 
00132     XAP_StringSet *         m_pStringSet;
00133     AP_Win32Clipboard *     m_pClipboard;
00134     static const bool       m_bForceAnsi = false; // boolean flag used for compatibility with UT_GetMessage
00135 };
00136 
00137 #endif /* AP_WIN32APP_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1