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 #ifndef AP_DIALOG_PAGENUMBERS_H 00021 #define AP_DIALOG_PAGENUMBERS_H 00022 00023 #include "xap_Frame.h" 00024 #include "xap_Dialog.h" 00025 #include "xav_View.h" 00026 #include "xap_Preview.h" 00027 00028 class FV_View; 00029 class AP_Dialog_Lists; 00030 class AP_Preview_Paragraph; 00031 class AP_Preview_PageNumbers; 00032 00033 class ABI_EXPORT AP_Dialog_PageNumbers : public XAP_Dialog_NonPersistent 00034 { 00035 public: 00036 00037 AP_Dialog_PageNumbers(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00038 virtual ~AP_Dialog_PageNumbers(void); 00039 00040 virtual void runModal(XAP_Frame * pFrame) = 0; 00041 00042 // answer from dialog 00043 typedef enum { a_OK, a_CANCEL } tAnswer; 00044 00045 // alignment ids 00046 typedef enum { id_RALIGN, id_LALIGN, id_CALIGN } tAlign; 00047 00048 // control ids 00049 typedef enum { id_HDR, id_FTR } tControl; 00050 00051 AP_Dialog_PageNumbers::tAlign getAlignment(void); 00052 AP_Dialog_PageNumbers::tAnswer getAnswer(void); 00053 00054 bool isHeader(void); 00055 bool isFooter(void); 00056 00057 protected: 00058 00059 // handle the XP-job of telling the preview what to draw 00060 void _updatePreview(AP_Dialog_PageNumbers::tAlign, AP_Dialog_PageNumbers::tControl); 00061 00062 // handle the XP-job of attaching something to our preview 00063 void _createPreviewFromGC(GR_Graphics * gc, 00064 UT_uint32 width, 00065 UT_uint32 height); 00066 00067 AP_Dialog_PageNumbers::tAnswer m_answer; 00068 AP_Dialog_PageNumbers::tAlign m_align; 00069 AP_Dialog_PageNumbers::tControl m_control; 00070 00071 AP_Preview_PageNumbers * m_preview; 00072 00073 XAP_Frame * m_pFrame; 00074 }; 00075 00076 class ABI_EXPORT AP_Preview_PageNumbers : public XAP_Preview 00077 { 00078 public: 00079 00080 AP_Preview_PageNumbers(GR_Graphics * gc); 00081 virtual ~AP_Preview_PageNumbers(void); 00082 00083 // data twiddlers 00084 void setHdrFtr(AP_Dialog_PageNumbers::tControl); 00085 void setAlign(AP_Dialog_PageNumbers::tAlign); 00086 00087 // where all the zoom-specific drawing happens 00088 void draw(const UT_Rect *clip=NULL); 00089 00090 protected: 00091 AP_Dialog_PageNumbers::tControl m_control; 00092 AP_Dialog_PageNumbers::tAlign m_align; 00093 00094 UT_UCSChar * m_str; 00095 }; 00096 00097 #endif /* AP_DIALOG_PAGENUMBERS_H */