00001 /* AbiSource Application Framework 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * Copyright (C) 2009 Hubert Figuiere 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 */ 00020 00021 #ifndef XAP_FONTPREVIEW_H 00022 #define XAP_FONTPREVIEW_H 00023 00024 #include <string> 00025 #include <map> 00026 00027 #ifndef UT_TYPES_H 00028 #include "ut_types.h" 00029 #endif 00030 #include "xap_Dlg_FontChooser.h" 00031 00032 class GR_Graphics; 00033 00034 // some hardcoded values for the preview window size 00035 #define PREVIEW_WIDTH 400 00036 #define PREVIEW_HEIGHT 75 00037 00038 class ABI_EXPORT XAP_FontPreview 00039 { 00040 public: 00041 typedef std::map<std::string,std::string> PropMap; 00042 00043 XAP_FontPreview(); 00044 virtual ~XAP_FontPreview(void); 00045 00046 void addOrReplaceVecProp(const std::string & pszProp, 00047 const std::string & pszVal); 00048 void setFontFamily(const gchar * pFontFamily); 00049 void setText(const gchar * pFontFamily); 00050 void draw(void); 00051 protected: 00052 void _createFontPreviewFromGC(GR_Graphics * gc, 00053 UT_uint32 width, 00054 UT_uint32 height); 00055 UT_sint32 m_width; 00056 UT_sint32 m_height; 00057 private: 00058 XAP_Preview_FontPreview * m_pFontPreview; 00059 UT_UCSChar * m_drawString; 00060 PropMap m_mapProps; 00061 }; 00062 00063 #endif /* XAP_FONTPREVIEW_H */