1 /* AbiWord 2 * Copyright (C) 1998 AbiSource, Inc. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 * 02110-1301 USA. 18 */ 19 20 #ifndef AP_DIALOG_PAGENUMBERS_H 21 #define AP_DIALOG_PAGENUMBERS_H 22 23 #include "xap_Frame.h" 24 #include "xap_Dialog.h" 25 #include "xav_View.h" 26 #include "xap_Preview.h" 27 28 class FV_View; 29 class AP_Dialog_Lists; 30 class AP_Preview_Paragraph; 31 class AP_Preview_PageNumbers; 32 33 class ABI_EXPORT AP_Dialog_PageNumbers : public XAP_Dialog_NonPersistent 34 { 35 public: 36 37 AP_Dialog_PageNumbers(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 38 virtual ~AP_Dialog_PageNumbers(void); 39 40 virtual void runModal(XAP_Frame * pFrame) = 0; 41 42 // answer from dialog 43 typedef enum { a_OK, a_CANCEL } tAnswer; 44 45 // alignment ids 46 typedef enum { id_RALIGN, id_LALIGN, id_CALIGN } tAlign; 47 48 // control ids 49 typedef enum { id_HDR, id_FTR } tControl; 50 51 AP_Dialog_PageNumbers::tAlign getAlignment(void); 52 AP_Dialog_PageNumbers::tAnswer getAnswer(void); 53 54 bool isHeader(void); 55 bool isFooter(void); 56 57 protected: 58 59 // handle the XP-job of telling the preview what to draw 60 void _updatePreview(AP_Dialog_PageNumbers::tAlign, AP_Dialog_PageNumbers::tControl); 61 62 // handle the XP-job of attaching something to our preview 63 void _createPreviewFromGC(GR_Graphics * gc, 64 UT_uint32 width, 65 UT_uint32 height); 66 67 AP_Dialog_PageNumbers::tAnswer m_answer; 68 AP_Dialog_PageNumbers::tAlign m_align; 69 AP_Dialog_PageNumbers::tControl m_control; 70 71 AP_Preview_PageNumbers * m_preview; 72 73 XAP_Frame * m_pFrame; 74 }; 75 76 class ABI_EXPORT AP_Preview_PageNumbers : public XAP_Preview 77 { 78 public: 79 80 AP_Preview_PageNumbers(GR_Graphics * gc); 81 virtual ~AP_Preview_PageNumbers(void); 82 83 // data twiddlers 84 void setHdrFtr(AP_Dialog_PageNumbers::tControl); 85 void setAlign(AP_Dialog_PageNumbers::tAlign); 86 87 // where all the zoom-specific drawing happens 88 void draw(const UT_Rect *clip=NULL); 89 90 protected: 91 AP_Dialog_PageNumbers::tControl m_control; 92 AP_Dialog_PageNumbers::tAlign m_align; 93 94 UT_UCSChar * m_str; 95 }; 96 97 #endif /* AP_DIALOG_PAGENUMBERS_H */ 98