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_PageSetup_H
21 #define AP_Dialog_PageSetup_H
22 
23 #include "ut_types.h"
24 #include "ut_units.h"
25 #include "xap_Frame.h"
26 #include "xap_Dialog.h"
27 #include "fp_PageSize.h"
28 
29 class ABI_EXPORT AP_Dialog_PageSetup : public XAP_Dialog_NonPersistent
30 {
31 public:
32 	AP_Dialog_PageSetup(XAP_DialogFactory *pDlgFactory, XAP_Dialog_Id id);
33 	virtual ~AP_Dialog_PageSetup() = 0;
34 
35 	virtual void runModal(XAP_Frame *pFrame) = 0;
36 
37 	typedef enum { a_OK, a_CANCEL } tAnswer;
38 	typedef enum { PORTRAIT, LANDSCAPE } Orientation;
39 
40 	// declare JavaBean-like accessors for our properties
41 #define SET_GATHER(a, u)  inline u get##a(void) const {return m_##a;} \
42 			  inline void set##a(u p##a) {m_##a = p##a;}
43 	SET_GATHER(PageSize,		fp_PageSize);
44 	SET_GATHER(PageUnits,		UT_Dimension);
45 	SET_GATHER(PageOrientation,	Orientation);
46 	SET_GATHER(PageScale,		int);
47 	SET_GATHER(MarginUnits,		UT_Dimension);
48 	SET_GATHER(MarginTop,		float);
49 	SET_GATHER(MarginBottom,	float);
50 	SET_GATHER(MarginLeft,		float);
51 	SET_GATHER(MarginRight,		float);
52 	SET_GATHER(MarginHeader,	float);
53 	SET_GATHER(MarginFooter,	float);
54 #undef SET_GATHER
55 
getAnswer(void)56 	virtual inline tAnswer getAnswer (void) const {return m_answer;}
57 
58  protected:
59 	// this should only get used by decendant classes
setAnswer(tAnswer answer)60 	inline void setAnswer (tAnswer answer) {m_answer = answer;}
61 	XAP_Frame * 		m_pFrame;
62 	AP_Dialog_PageSetup::tAnswer m_answer;
63 
64     bool validatePageSettings(void) const;
65 
66  private:
67 	fp_PageSize             m_PageSize;
68 	UT_Dimension            m_PageUnits;
69 	Orientation             m_PageOrientation;
70 	int                     m_PageScale;
71 	UT_Dimension            m_MarginUnits;
72 	float                   m_MarginTop;
73 	float                   m_MarginBottom;
74 	float                   m_MarginLeft;
75 	float                   m_MarginRight;
76 	float                   m_MarginHeader;
77 	float                   m_MarginFooter;
78 };
79 
80 #endif // AP_Dialog_PageSetup_H
81